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

Make DOCKER_USERNAME and _PASSWORD optional #73

Conversation

consideRatio
Copy link
Member

@consideRatio consideRatio commented Jul 7, 2021

The idea is that by making these fields optional, we support letting the
user of the action pre-configure credentials or use already configured
credentials instead.

Closes #70

@welcome

This comment has been minimized.

The idea is that by making these fields optional, we support letting the
user of the action pre-configure credentials or use already configured
credentials instead.
@consideRatio consideRatio force-pushed the pr/make-docker-username-password-optional branch from 8e601fa to 6d3ca73 Compare July 7, 2021 22:39
Copy link
Member Author

@consideRatio consideRatio left a comment

Choose a reason for hiding this comment

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

I wrote some notes as all the changes are bundled to a single commit. Ping @yuvipanda who opened #70 that this PR is meant to close.

MYBINDERORG_TAG: ${{ github.sha }}

Copy link
Member Author

Choose a reason for hiding this comment

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

action.yml declared DOCKER_USERNAME as required, and this test didn't explicitly set DOCKER_USERNAME but instead relied on a script to populate the INPUT_DOCKER_USERNAME variable with the github actor.

I think it is cleaner to do it like this though. I was clueless about the scripts logic as it seemed like something that shouldn't be able to happen until I saw the GitHub workflow CI failure.

README.md Outdated
Comment on lines 53 to 60
- **`DOCKER_USERNAME`**:
description: Docker registry username. If not supplied, credentials must be setup ahead of time.
- **`DOCKER_PASSWORD`**:
description: Docker registry password or [access token (recommended)](https://docs.docker.com/docker-hub/access-tokens/). If not supplied, credentials must be setup ahead of time.
- **`DOCKER_REGISTRY`**:
description: name of the docker registry. If not supplied, this defaults to [DockerHub](https://hub.docker.com/)
- **`IMAGE_NAME`**:
name of the image. Example - myusername/myContainer. If not supplied, this defaults to `<DOCKER_USERNAME/GITHUB_REPOSITORY_NAME>`.
Copy link
Member Author

Choose a reason for hiding this comment

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

I moved DOCKER_USERNAME and PASSWORD from the mandatory section to the optional section. The other inputs were relocated to have the same order as in the action.yml file.

Comment on lines -30 to -34
# Set Docker username to the actor name not provided
if [ -z "$INPUT_DOCKER_USERNAME" ]; then
INPUT_DOCKER_USERNAME="$GITHUB_ACTOR"
fi

Copy link
Member Author

Choose a reason for hiding this comment

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

This logic was only applied during a CI test as DOCKER_USERNAME was declared required in action.yml. I removed this section in favor of making the CI test explicitly set DOCKER_USERNAME to ${{ github.actor }} instead as discussed in a comment above.

@hamelsmu
Copy link
Collaborator

hamelsmu commented Jul 7, 2021

LGTM

Copy link
Member

@manics manics left a comment

Choose a reason for hiding this comment

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

I've made a couple of comments on improving the DOCKER_REGISTRY description.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
action.yml Outdated Show resolved Hide resolved
Co-authored-by: Simon Li <orpheus+devel@gmail.com>
README.md Outdated Show resolved Hide resolved
@yuvipanda yuvipanda merged commit 0593da7 into jupyterhub:master Jul 10, 2021
@welcome
Copy link

welcome bot commented Jul 10, 2021

Congrats on your first merged pull request in this project! 🎉
congrats
Thank you for contributing, we are very proud of you! ❤️

@yuvipanda
Copy link
Collaborator

Thanks a lot, @consideRatio and @manics!!!

@yuvipanda yuvipanda mentioned this pull request Jul 15, 2021
# Set image name to username/repo_name if not provided
if [ -z "$INPUT_IMAGE_NAME" ]; then
if [[ -z "$INPUT_DOCKER_USERNAME" ]]; then
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is causing #74. If IMAGE_NAME is not set but NO_PUSH is set, this is all ok...

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.

Support pushing to multiple registries
4 participants