Skip to content

Commit

Permalink
Merge pull request #300 from cherwin/master
Browse files Browse the repository at this point in the history
Allow insecure registries
  • Loading branch information
xtremerui authored Sep 23, 2021
2 parents 63e5d52 + aeead57 commit 53d4bf5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ differences:
*Note: If using ecr you only need the repository name, not the full URI e.g.
`alpine` not `012345678910.dkr.ecr.us-east-1.amazonaws.com/alpine`*

* `insecure`: *Optional. Default `false`* Allow insecure registry.

* `tag`: *Optional.* Instead of monitoring semver tags, monitor a single tag
for changes (based on digest).

Expand Down
7 changes: 6 additions & 1 deletion commands/out.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,12 @@ func put(req resource.OutRequest, img v1.Image, tags []name.Tag) error {
identifiers = append(identifiers, tag.Identifier())
}

repo, err := name.NewRepository(req.Source.Repository)
var repoOpts []name.Option
if req.Source.Insecure {
repoOpts = append(repoOpts, name.Insecure)
}

repo, err := name.NewRepository(req.Source.Repository, repoOpts...)
if err != nil {
return fmt.Errorf("resolve repository name: %w", err)
}
Expand Down
2 changes: 2 additions & 0 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ type RegistryMirror struct {
type Source struct {
Repository string `json:"repository"`

Insecure bool `json:"insecure"`

PreReleases bool `json:"pre_releases,omitempty"`
Variant string `json:"variant,omitempty"`

Expand Down
2 changes: 1 addition & 1 deletion types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var _ = Describe("Source", func() {
json, err := json.Marshal(source)
Expect(err).ToNot(HaveOccurred())

Expect(json).To(MatchJSON(`{"repository":"foo","tag":"0"}`))
Expect(json).To(MatchJSON(`{"repository":"foo","insecure":false,"tag":"0"}`))
})

Describe("ecr", func() {
Expand Down

0 comments on commit 53d4bf5

Please sign in to comment.