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

Support for multiple tags? #29

Closed
andmos opened this issue Apr 12, 2021 · 7 comments · Fixed by #30
Closed

Support for multiple tags? #29

andmos opened this issue Apr 12, 2021 · 7 comments · Fixed by #30
Assignees
Labels
enhancement New feature or request

Comments

@andmos
Copy link

andmos commented Apr 12, 2021

Question

Not sure if this is a bug or a feature request, so I'm doing it as a question 😄

I want to use the s2i-build action, but we need to tag the image with multiple tags. So far as I can see, this action does not support it?

My initial thought was to use the push-to-registry action to do all the tagging (since push-to-registry support a list of tags), but it looks like push-to-registry needs a 1 to 1 mapping between tags to push.

Anything I'm missing here, or does this go as a feature request to support multiple tags? 😄

@andmos andmos added the question Further information is requested label Apr 12, 2021
@divyansh42
Copy link
Member

@andmos This seems to be a good feature request 👍
We will try to get this done 🙂

@divyansh42 divyansh42 self-assigned this Apr 12, 2021
@andmos
Copy link
Author

andmos commented Apr 12, 2021

From what I can see here, it might be that the tagging must be a separate tag step. Not sure if s2i support multiple tags without doing the tagging separately with e.g docker tag

const buildCmd = [ "build", pathContext, builderImage, `${imageName}:${imageTag}`,

@divyansh42 divyansh42 added enhancement New feature or request and removed question Further information is requested labels Apr 13, 2021
@andmos
Copy link
Author

andmos commented Apr 14, 2021

Here is an example of this done in Bash from a custom Action I've used:

set -e
if [ "$5" = "" ]; then
    echo "Skipping login for image pull - username not set."
else
    echo "Credentials for builder image registry detected - logging in."
#    echo "$6" | docker login "$4" --username "$5" --password-stdin
fi
# We will always need to login to the registry we intend to push to
#echo "$9" | docker login "$7" --username "$8" --password-stdin
# Grab builder image
docker pull "$2"
# Build
s2i build "$1" "$2" "$3"

TAGS="${10}"

if [ "$TAGS" = "" ]; then
    echo "Skipping custom tagging, using latest - tags not set."
else 
    for TAG in ${TAGS//,/ }
    do
        echo "Tagging image ${3} with ${TAG}"
        docker tag "${3}" "${3}:${TAG}"
    done
fi
# Push to output registry

docker push "$3"

@divyansh42
Copy link
Member

divyansh42 commented Apr 14, 2021

Yeah, we did the same way in buildah-build action.
There is no option to provide multiple tags in s2i.

@divyansh42
Copy link
Member

I am going to use docker here to tag, as s2i has dependency on docker
Ref: https://github.com/openshift/source-to-image#dependencies

@divyansh42
Copy link
Member

Also added outputs image and tags which outputs name of image built and list of tags respectively. (similar to what we have in buildah-build action)

@divyansh42
Copy link
Member

@andmos you should be able to use this feature in redhat-actions/s2i-build@v2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants