Skip to content

Add github actions workflow for mirroring images using regsync #854

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

Merged
merged 6 commits into from
Apr 9, 2025

Conversation

adamkpickering
Copy link
Contributor

@adamkpickering adamkpickering commented Mar 18, 2025

Also:

  • Add a workflow for running golangci-lint and go test on Go code during PR checks.
  • Simplify user/password/registry settings in config.yaml.

Until we are more confident in these changes, regsync-based mirroring can only be triggered via a workflow_dispatch event.

@adamkpickering adamkpickering force-pushed the github-actions-mirror branch 2 times, most recently from 0fd0c4d to f90b76e Compare March 24, 2025 18:08
@adamkpickering adamkpickering force-pushed the github-actions-mirror branch from f90b76e to 0485f38 Compare March 25, 2025 18:54
@adamkpickering adamkpickering force-pushed the github-actions-mirror branch from 0485f38 to 313dce5 Compare March 25, 2025 20:38
@adamkpickering adamkpickering marked this pull request as ready for review March 25, 2025 20:41
@adamkpickering adamkpickering requested a review from a team as a code owner March 25, 2025 20:41
diogoasouza
diogoasouza previously approved these changes Mar 25, 2025
Copy link
Contributor

@diogoasouza diogoasouza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines 19 to 33
if [ -n "${{ secrets.DEBUG_DOCKER_USERNAME }}" ]; then
echo "manual_secrets=true" >> $GITHUB_OUTPUT
elif [ -n "${{ secrets.DEBUG_DOCKER_PASSWORD }}" ]; then
echo "manual_secrets=true" >> $GITHUB_OUTPUT
elif [ -n "${{ secrets.DEBUG_APPCO_USERNAME }}" ]; then
echo "manual_secrets=true" >> $GITHUB_OUTPUT
elif [ -n "${{ secrets.DEBUG_APPCO_PASSWORD }}" ]; then
echo "manual_secrets=true" >> $GITHUB_OUTPUT
elif [ -n "${{ secrets.DEBUG_PRIME_USERNAME }}" ]; then
echo "manual_secrets=true" >> $GITHUB_OUTPUT
elif [ -n "${{ secrets.DEBUG_PRIME_PASSWORD }}" ]; then
echo "manual_secrets=true" >> $GITHUB_OUTPUT
else
echo "manual_secrets=false" >> $GITHUB_OUTPUT
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this something that needs to be committed, or is this just for debugging in PR CI?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for developing the workflow. Specifically, its for setting the secrets when running the workflow in one's personal fork - there is no way to do this when fetching the secrets via the EIO action.

Do you not want it there? I suppose this can be added back if we need to develop further, but IMO it's nice to have for when things break in the future. Certainly not ideal, but then again, neither is github actions...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little sketched out by having stuff that's not used by GHA, in the GHA config. Is there any reason you can't just set the non-DEBUG env vars when you're running the tests locally?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea behind the DEBUG env vars was to be able to test the workflow with as close as possible of an environment as I could get to the final one. I find it's easy to make little mistakes in GHA, so this has been my strategy to avoid having to make a bunch of PRs to what is essentially production.

But I see your point. Having DEBUG vars possibly opens the door to abuse, and it clutters up the workflow somewhat. I'll remove the DEBUG variables.

Comment on lines 59 to 64
DOCKER_USERNAME: ${{ secrets.DEBUG_DOCKER_USERNAME && secrets.DEBUG_DOCKER_USERNAME || secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DEBUG_DOCKER_PASSWORD && secrets.DEBUG_DOCKER_PASSWORD || secrets.DOCKER_PASSWORD }}
APPCO_USERNAME: ${{ secrets.DEBUG_APPCO_USERNAME && secrets.DEBUG_APPCO_USERNAME || secrets.APPCO_USERNAME }}
APPCO_PASSWORD: ${{ secrets.DEBUG_APPCO_PASSWORD && secrets.DEBUG_APPCO_PASSWORD || secrets.APPCO_PASSWORD }}
PRIME_USERNAME: ${{ secrets.DEBUG_PRIME_USERNAME && secrets.DEBUG_PRIME_USERNAME || secrets.PRIME_USERNAME }}
PRIME_PASSWORD: ${{ secrets.DEBUG_PRIME_PASSWORD && secrets.DEBUG_PRIME_PASSWORD || secrets.PRIME_PASSWORD }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question - what is the purposed of the DEBUG_ secrets?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in #854 (comment)

@adamkpickering adamkpickering merged commit 31cd6af into rancher:master Apr 9, 2025
3 checks passed
@adamkpickering adamkpickering deleted the github-actions-mirror branch April 9, 2025 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants