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

align image tagging with development image #1438

Open
tomeichlersmith opened this issue Sep 5, 2024 · 1 comment
Open

align image tagging with development image #1438

tomeichlersmith opened this issue Sep 5, 2024 · 1 comment
Labels
container docker Pull requests that update Docker code

Comments

@tomeichlersmith
Copy link
Member

In the development image, we use docker's metadata action to deduce the tags and labels for the image.

https://github.com/LDMX-Software/docker/blob/1c729e21b606ac9400e2e29c184a645e14c39338/.github/workflows/ci.yml#L36-L41

but here, we use some scripting I threw together since this action wasn't available at the time.

-
name: Determine Image Tags
id: generate_tag
run: |
source ${GITHUB_WORKSPACE}/.github/actions/common.sh
_tags=""
if [[ $GITHUB_EVENT_NAME == "workflow_dispatch" ]]; then
_repo=${{ github.event.inputs.repo }}
_input_tag=${{ github.event.inputs.tag }}
if [[ ${_repo} == "ldmx/pro" ]]; then
error "Provided 'ldmx/pro' repo on non-trunk branch."
exit 1
fi
_tags="${_repo}:${_input_tag},${_repo}:sha-${GITHUB_SHA::8}"
elif [[ $GITHUB_REF == refs/tags/* ]]; then
# if pushing a git tag ==> get the git tag for the docker tag
_git_tag=${GITHUB_REF#refs/tags/}
_tags="ldmx/pro:$_git_tag"
if [[ $_git_tag =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
# there was a version released on github
# v<1-3 digits>.<1-3 digits>.<1-3 digits>
_tags="$_tags,ldmx/pro:latest"
fi
elif [[ $GITHUB_REF == refs/heads/* ]]; then
#pushing to trunk
_tags="ldmx/pro:edge,ldmx/pro:sha-${GITHUB_SHA::8}"
else
error "Running Determine Image Tags on a commit that isn't a tag or a branch."
exit 1
fi
set_output tags ${_tags}
set_output should_push ${_should_push}
shell: bash

I'd like to update to docker's metadata action for the following reasons:

  • The dev image does not put a v prefixing the image version while the pro image does. This is confusing and switching to the metadata action would resolve this.
  • The pro image just inherits the labels from the dev image which, most confusingly, includes a version label which actually corresponds to the dev image version and not the ldmx-sw version. Switching to the metadata action would resolve this.
  • The pro image doesn't have any arm builds. We could attach the image building runner at UMN to this repository as well and use it here to make sure the pro image also has arm builds.
@tomeichlersmith tomeichlersmith added container docker Pull requests that update Docker code labels Sep 5, 2024
@tomeichlersmith
Copy link
Member Author

If you are on an Apple Silicon computer - the most common (or only?) situation where an ARM-architecture production image is required, then you can build the production image locally and use it the same way as someone who can pull the centrally-built images. You would probably see something like

$ denv init ldmx/pro:v4.1.0
v4.1.0: Pulling from ldmx/pro
no matching manifest for linux/arm64/v8 in the manifest list entries

This error message points out that we currently don't build ARM images for the production image (thus the linux/arm64/v8 is not one of the "entries" in the "manifest").

Local Building

In some directory...

git clone [email protected]:LDMX-Software/ldmx-sw.git
cd ldmx-sw
git checkout <version>
docker build . -t ldmx/pro:<version>

Usage

Same as if you could use the ldmx/pro image on your ARM machine.

denv init ldmx/pro:<version>

The only difference is that the available <version>s are only the ones you build with the above procedure.
Reminder: denv init should occur in some other directory besides ldmx-sw to keep the environments separate. Stay organized and have different directories for you different projects!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
container docker Pull requests that update Docker code
Projects
None yet
Development

No branches or pull requests

1 participant