Fix docker: invalid reference format (#767)
* Fix local Docker actions: invalid reference format * Create Dockerfile * Create Dockerfile * Update push.yml * Revert "Create Dockerfile" This reverts commit 9d1dbbc2c7fdf52963e55feb4148ac2b14d639d0. * Fix lint * fix: re-use image that is already present in repo ubuntu:latest would pull unnecessary blobs from registry and count toward API limit * fix: revert change reverting due to issue in image deletion that will have to be investigated separately Co-authored-by: Ryan <me@hackerc.at>
This commit is contained in:
parent
5c841e22ab
commit
77b3968913
3 changed files with 5 additions and 1 deletions
|
@ -506,7 +506,8 @@ func (sc *StepContext) execAsDocker(ctx context.Context, action *model.Action, a
|
||||||
if strings.HasPrefix(action.Runs.Image, "docker://") {
|
if strings.HasPrefix(action.Runs.Image, "docker://") {
|
||||||
image = strings.TrimPrefix(action.Runs.Image, "docker://")
|
image = strings.TrimPrefix(action.Runs.Image, "docker://")
|
||||||
} else {
|
} else {
|
||||||
image = fmt.Sprintf("%s:%s", regexp.MustCompile("[^a-zA-Z0-9]").ReplaceAllString(actionName, "-"), "latest")
|
// "-dockeraction" enshures that "./", "./test " won't get converted to "act-:latest", "act-test-:latest" which are invalid docker image names
|
||||||
|
image = fmt.Sprintf("%s-dockeraction:%s", regexp.MustCompile("[^a-zA-Z0-9]").ReplaceAllString(actionName, "-"), "latest")
|
||||||
image = fmt.Sprintf("act-%s", strings.TrimLeft(image, "-"))
|
image = fmt.Sprintf("act-%s", strings.TrimLeft(image, "-"))
|
||||||
image = strings.ToLower(image)
|
image = strings.ToLower(image)
|
||||||
basedir := actionLocation
|
basedir := actionLocation
|
||||||
|
|
|
@ -9,3 +9,4 @@ jobs:
|
||||||
- uses: ./actions/docker-local
|
- uses: ./actions/docker-local
|
||||||
with:
|
with:
|
||||||
who-to-greet: 'Mona the Octocat'
|
who-to-greet: 'Mona the Octocat'
|
||||||
|
- uses: ./localdockerimagetest_
|
||||||
|
|
2
pkg/runner/testdata/localdockerimagetest_/Dockerfile
vendored
Normal file
2
pkg/runner/testdata/localdockerimagetest_/Dockerfile
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
FROM ubuntu:latest
|
||||||
|
CMD echo Hello
|
Loading…
Reference in a new issue