Skip to content

Commit

Permalink
first shot at adding ability to use docker dist api to get image conf…
Browse files Browse the repository at this point in the history
…ig (#47)

* first shot at adding ability to use docker dist api to get image config

Signed-off-by: vsoch <vsoch@users.noreply.github.com>

* missing file

Signed-off-by: vsoch <vsoch@users.noreply.github.com>

* finishing up looking up containers in cache

Signed-off-by: vsoch <vsoch@users.noreply.github.com>

Co-authored-by: vsoch <vsoch@users.noreply.github.com>
  • Loading branch information
vsoch and vsoch committed Sep 17, 2021
1 parent 47a5e15 commit 54cddac
Show file tree
Hide file tree
Showing 10 changed files with 486 additions and 169 deletions.
7 changes: 4 additions & 3 deletions cli/dockerbuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ type DockerBuildArgs struct {
}

type DockerBuildFlags struct {
Changes bool `long:"changes" desc:"Only consider changed uptodate files"`
Branch string `long:"branch" desc:"Branch to compare HEAD against, defaults to main"`
Registry string `long:"registry" desc:"A registry is required to look up changes from previous builds."`
Changes bool `long:"changes" desc:"Only consider changed uptodate files"`
Branch string `long:"branch" desc:"Branch to compare HEAD against, defaults to main"`
}

// Dockerfile updates one or more Dockerfile
Expand Down Expand Up @@ -52,6 +53,6 @@ func RunDockerBuild(r *cmd.Root, c *cmd.Sub) {

// Update the dockerfiles with a Dockerfile parser
parser := docker.DockerBuildParser{}
parser.Parse(args.Root[0], flags.Changes, flags.Branch)
parser.Parse(args.Root[0], flags.Changes, flags.Branch, flags.Registry)

}
12 changes: 10 additions & 2 deletions docs/docs/user-guide/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,17 @@ And to only include changed uptodate.yaml files:
```bash
$ uptodate dockerbuild --changes
```
And finally, if you want the most functionality (not just to look for changes to files but
also check previous images and rebuild those that have detailed changes in build args) then you
need to provide uptodate with the registry that the images are intended for (and this also
assumes you use the build names that are generated).
We could add support for changed associated Dockerfile too - please [open an issue](https://github.com/vsoch/uptodate/issues)
is this is interesting to you.
```bash
$ uptodate dockerbuild --registry ghcr.io/rse-radiuss
```
Note that the registry flag is enough to indicate that you want to look for changes of
this type.
### Git
Expand Down
7 changes: 6 additions & 1 deletion parsers/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ func GetVersions(contenders []string, filters []string, startAtVersion string, e

// Do we have semantic versions? If so, this is the better sort
if HasSemanticVersions(contenders) {
contenders = SortVersions(contenders)
newContenders := SortVersions(contenders)

// But only use if it doesn't remove everything!
if len(newContenders) > 0 {
contenders = newContenders
}
}

// We look for tags based on filters (this is an OR between them)
Expand Down

0 comments on commit 54cddac

Please sign in to comment.