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

Replace docker.sh script with GitHub Actions #4387

Merged
merged 1 commit into from
Jul 13, 2023

Conversation

der-eismann
Copy link
Contributor

This PR replaces the docker.sh script with pure GitHub Actions, which makes it way easier to solve #3948 since we can just add platforms: linux/arm64 then.

The current behavior is copied without changes:

  • Login and push only on pushes to oracle/opengrok
  • Images will be tagged by branch name, PR name or tag name, where tags will also get the latest image tag

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jul 10, 2023
@vladak
Copy link
Member

vladak commented Jul 11, 2023

This looks fine on cursory view; before merging this in I need to check whether the docker Github Actions are allowed for the OpenGrok repository.

@vladak
Copy link
Member

vladak commented Jul 13, 2023

Confirmed that docker/* actions are allowed for this repository so from this standpoint this is okay.

@vladak
Copy link
Member

vladak commented Jul 13, 2023

Merging, will see how this works when the next OpenGrok release is ready. Thanks !

@vladak vladak merged commit a47e52c into oracle:master Jul 13, 2023
7 of 9 checks passed
@vladak
Copy link
Member

vladak commented Jul 13, 2023

Looks like the docker image push for the master failed: https://github.com/oracle/opengrok/actions/runs/5542739458/jobs/10117809269 with:

#38 ERROR: denied: requested access to the resource is denied
------
 > pushing oracle/opengrok:master with docker:
------
ERROR: denied: requested access to the resource is denied

@der-eismann
Copy link
Contributor Author

I'm very confused by this error. Since the login succeeded and the push failed, it would suggest that the user is actually missing permissions (like this comment said: docker/build-push-action#853 (comment)). But assuming it worked before and you didn't change anything it doesn't really make sense.

Since this is hard for me to verify and test I'd suggest you revert this PR unfortunately and maybe tackle it another day. However everything else looks fine and the token should be valid for more than 4 minutes. No idea why this is failing, sorry 😕

@vladak
Copy link
Member

vladak commented Jul 17, 2023

There are 2 possibilities - either the actions setup wrong username/password or the associated user has insufficient permissions. I changed the username/password recently to use a token. Looking at the token, it has all the permissions. Looking at the error message pushing oracle/opengrok:master with docker:, it is not clear to me whether the last part (docker:) is the username used.

@vladak
Copy link
Member

vladak commented Aug 15, 2023

The docker/build-push-action uses https://github.com/docker/buildx. The error message comes from https://github.com/docker/buildx/blob/86ae8ea854e639a3267399fdf3f99e9b900f6e09/build/build.go#L988 and there is no indication which username/password was used. The actual push is done via https://github.com/moby/buildkit. This seems to be using REST API reference on docker.io.

I created new API token on docker.io associated with the username used for the Github action, used a clone of the OpenGrok repository, set the DOCKER_USERNAME and DOCKER_PASSWORD in the Secrets and variables of that repository clone and let the Docker action run. It failed in the same way.

The user has 2FA setup, which might be related. That said, using the same username/password with the command line docker tool, I was able to successfully push the image to under my user on docker.io.

I don't have the capacity to investigate the inner workings of the above tools, so reverted the change in cf02a2b for now. It would be nice to try it again later.

@vladak
Copy link
Member

vladak commented Aug 15, 2023

For the record, the docker/login-action is merely a wrapper for the docker login command (https://github.com/docker/login-action/blob/553b6f090f15b58451081ce157ff1929a266131d/src/docker.ts#L28C4-L40), at least for Docker hub. So either the authentication credentials stored by this command are not getting picked up by the buildx/moby or there is some difference between how these are used compared to docker push.

@der-eismann der-eismann deleted the replace-docker.sh-script branch January 4, 2024 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants