Skip to content

Commit

Permalink
fix: Remove unnecessary warning
Browse files Browse the repository at this point in the history
  • Loading branch information
julienvey committed Jan 6, 2022
1 parent c05cbf1 commit 60d42df
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 35 deletions.
19 changes: 7 additions & 12 deletions dag/dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,14 @@ func (dag *DAG) GenerateDAG(buildPath string, registryPrefix string) {
if !hasSkipLabel {
return fmt.Errorf("missing label \"image\" in Dockerfile at path \"%s\"", filePath)
}
version, hasSkipLabel := dockerfile.Labels["version"]
if !hasSkipLabel {
logrus.Warnf("missing label \"version\" in Dockerfile at path \"%s\"", filePath)
}
img := &Image{
Name: fmt.Sprintf("%s/%s", registryPrefix, imageShortName),
ShortName: imageShortName,
InlineVersion: version,
Dockerfile: dockerfile,
RebuildCond: sync.NewCond(&sync.Mutex{}),
Builder: dag.Builder,
Registry: dag.Registry,
TestRunners: dag.TestRunners,
Name: fmt.Sprintf("%s/%s", registryPrefix, imageShortName),
ShortName: imageShortName,
Dockerfile: dockerfile,
RebuildCond: sync.NewCond(&sync.Mutex{}),
Builder: dag.Builder,
Registry: dag.Registry,
TestRunners: dag.TestRunners,
}

allParents[img.Name] = dockerfile.From
Expand Down
5 changes: 2 additions & 3 deletions dag/dag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ import (

func newImage(name string, contextPath string) *dag.Image {
return &dag.Image{
Name: name,
ShortName: path.Base(contextPath),
InlineVersion: "v1",
Name: name,
ShortName: path.Base(contextPath),
Dockerfile: &dockerfile.Dockerfile{
ContextPath: contextPath,
Filename: "Dockerfile",
Expand Down
19 changes: 2 additions & 17 deletions dag/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ var rateLimit = make(chan struct{}, maxGoroutines)
type Image struct {
Name string
ShortName string
InlineVersion string
Dockerfile *dockerfile.Dockerfile
Children []*Image
Parents []*Image
Expand Down Expand Up @@ -233,22 +232,8 @@ func (img *Image) doRetag(newTag, oldTag string) error {
if previousTagExists {
return img.retagRemote(oldTag, newTag)
} else {
inlineVersionTagExists, err := img.Registry.RefExists(img.dockerRef(img.InlineVersion))
if err != nil {
return err
}
if inlineVersionTagExists {
logrus.Warnf(
"Previous tag \"%s:%s\" missing, image will be retagged with inline version \"%s\"",
img.Name,
oldTag,
img.InlineVersion,
)
return img.retagRemote(img.InlineVersion, newTag)
} else {
logrus.Warnf("Previous tag \"%s:%s\" missing, image will be rebuilt", img.Name, oldTag)
img.tagForRebuild()
}
logrus.Warnf("Previous tag \"%s:%s\" missing, image will be rebuilt", img.Name, oldTag)
img.tagForRebuild()
}
}
return nil
Expand Down
5 changes: 2 additions & 3 deletions dag/image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,8 @@ func createImage(registry *mock.Registry, builder *mock.Builder, tester *mock.Te
}

return dag.Image{
Name: "eu.gcr.io/my-test-repository/test",
ShortName: "test",
InlineVersion: "",
Name: "eu.gcr.io/my-test-repository/test",
ShortName: "test",
Dockerfile: &dockerfile.Dockerfile{
ContextPath: "../test/fixtures",
Filename: "Dockerfile",
Expand Down

0 comments on commit 60d42df

Please sign in to comment.