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:
ChristopherHX 2021-08-09 20:16:31 +02:00 committed by GitHub
parent 5c841e22ab
commit 77b3968913
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 1 deletions

View file

@ -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

View file

@ -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_

View file

@ -0,0 +1,2 @@
FROM ubuntu:latest
CMD echo Hello