Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actions Container image is misinterpreted when using own registry with short oci url #795

Closed
FloThinksPi opened this issue Sep 1, 2021 · 5 comments · Fixed by #877
Closed
Assignees
Labels
area/runner Relating to errors in the runner kind/bug Something isn't working stale-exempt Exempt from stale

Comments

@FloThinksPi
Copy link

System information

  • Operating System: MacOS
  • Architecture: x64 (64-bit)
  • Apple M1: no
  • Docker version: 20.10.8
  • act version: act version 0.2.24

Expected behaviour

Pulls the correct image

Actual behaviour

Adds docker.io to the image which already has a private repo specified and thus the url is invalid.

Workflow and/or repository

workflow
jobs:
  myjob:
    runs-on: [self-hosted, linux]
    name: test job
    container:
      image: myregistry:50000/ubuntu:20.04

Steps to reproduce

Create workflow with custom container image in job step(see workflow file above).
Watch pull fail.

act output

If i just do a act without verbose i get:

[Run database tests/Run psql db tests] 🚀  Start image=myregistry:50000/ubuntu:20.04
Error: invalid reference format

So image pull URL looks fine.

However if i do act -vvv on the same workflow i get:

[Run database tests/Run psql db tests]   🐳  docker pull myregistry:50000/ubuntu:20.04
DEBU[0000] Image exists? false                          
[Run database tests/Run psql db tests] pulling image 'docker.io/myregistry:50000/ubuntu:20.04' ()
DEBU[0000] invalid reference format                     

So here one can see it puts a docker.io in front of the already complete OCI Resource URL.
Then it fails as this obviously is not allowed.

@FloThinksPi FloThinksPi added the kind/bug Something isn't working label Sep 1, 2021
@FloThinksPi
Copy link
Author

FloThinksPi commented Sep 1, 2021

It seems to work if i use:
myrepo:50000/library/ubuntu:20.04
Then the correct image is pulled.

I think act has some logic in it that interprets myrepo:50000/ubuntu:20.04 as myrepo:50000 beeing the username and ubuntu beeing the image and 20.04 beeing the tag. So it appends docker.io as registry url then.

However Docker pull on myrepo:50000/ubuntu:20.04 works as expected though and pulls the right image(which long url would be myrepo:50000/library/ubuntu:20.04). So i think it is actually wanted to pull the image that the container runtime would pull. So to interpret myrepo:50000 as url and not as username in that case.

@FloThinksPi FloThinksPi changed the title Actions Container image is misinterpreted when using own registry Actions Container image is misinterpreted when using own registry with short oci url Sep 1, 2021
@catthehacker
Copy link
Member

func cleanImage(image string) string {
imageParts := len(strings.Split(image, "/"))
if imageParts == 1 {
image = fmt.Sprintf("docker.io/library/%s", image)
} else if imageParts == 2 {
image = fmt.Sprintf("docker.io/%s", image)
}
return image
}

@catthehacker catthehacker self-assigned this Sep 1, 2021
@catthehacker catthehacker added the area/runner Relating to errors in the runner label Sep 1, 2021
@github-actions

This comment has been minimized.

@github-actions github-actions bot added the stale label Oct 2, 2021
@catthehacker

This comment has been minimized.

@github-actions github-actions bot removed the stale label Oct 3, 2021
@github-actions

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/runner Relating to errors in the runner kind/bug Something isn't working stale-exempt Exempt from stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants