You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
StageFroms []string// every image "FROM" instruction value (or the parent stage's FROM value in the case of a named stage)
22
-
StageNames []string// the name of any named stage (in order)
23
-
StageNameFromsmap[string]string// map of stage names to FROM values (or the parent stage's FROM value in the case of a named stage), useful for resolving stage names to FROM values
24
-
25
-
Froms []string// every "FROM" or "COPY --from=xxx" value (minus named and/or numbered stages in the case of "--from=")
26
-
}
27
-
28
20
// this returns the "FROM" value for the last stage (which essentially determines the "base" for the final published image)
// (TODO see note above regarding "escape" parser directive)
121
-
forline[len(line)-1] =='\\'&&scanner.Scan() {
122
-
nextLine:=strings.TrimSpace(scanner.Text())
123
-
ifnextLine==""||nextLine[0] =='#' {
124
-
// ignore blank lines and comments
125
-
continue
126
-
}
127
-
line=line[0:len(line)-1] +nextLine
128
-
}
129
-
130
-
fields:=strings.Fields(line)
131
-
iflen(fields) <1 {
132
-
// must be a much more complex empty line??
133
-
continue
134
-
}
135
-
instruction:=strings.ToUpper(fields[0])
136
-
137
-
// TODO balk at ARG / $ in from values
138
-
139
-
switchinstruction {
140
-
case"FROM":
141
-
from:=fields[1]
142
-
143
-
ifstageFrom, ok:=meta.StageNameFroms[from]; ok {
144
-
// if this is a valid stage name, we should resolve it back to the original FROM value of that previous stage (we don't care about inter-stage dependencies for the purposes of either tag dependency calculation or tag building -- just how many there are and what external things they require)
0 commit comments