-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix upgrade bug for GitHub Actions container refs (#85)
There was a bug with "upgrade" wherein GitHub Actions container refs were losing their "docker://" prefix. This also introduces a new "-pin" flag to the "upgrade" command, which can be used to skip pinning upgraded refs.
- Loading branch information
Showing
13 changed files
with
124 additions
and
18 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package resolver | ||
|
||
import ( | ||
"context" | ||
"regexp" | ||
"testing" | ||
) | ||
|
||
func TestContainer_Resolve(t *testing.T) { | ||
t.Parallel() | ||
|
||
ctx := context.Background() | ||
resolver, err := NewContainer(ctx) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
cases := []struct { | ||
name string | ||
in string | ||
exp string | ||
}{ | ||
{ | ||
name: "default", | ||
in: "alpine:3", | ||
exp: "index.docker.io/library/alpine@sha256:[0-9a-f]{64}", | ||
}, | ||
{ | ||
name: "sha", | ||
in: "alpine@sha256:dabf91b69c191a1a0a1628fd6bdd029c0c4018041c7f052870bb13c5a222ae76", | ||
exp: "alpine@sha256:dabf91b69c191a1a0a1628fd6bdd029c0c4018041c7f052870bb13c5a222ae76", | ||
}, | ||
} | ||
|
||
for _, tc := range cases { | ||
tc := tc | ||
|
||
t.Run(tc.name, func(t *testing.T) { | ||
t.Parallel() | ||
|
||
result, err := resolver.Resolve(ctx, tc.in) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
match, err := regexp.MatchString(tc.exp, result) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
if !match { | ||
t.Errorf("expected %q to match %q", result, tc.exp) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
jobs: | ||
docker: | ||
steps: | ||
- name: 'docker' | ||
uses: 'docker://alpine:3' | ||
with: | ||
entrypoint: '/bin/sh' | ||
args: '-euc "test -n "/bin/sh"' |