zymap commented on code in PR #3658: URL: https://github.com/apache/bookkeeper/pull/3658#discussion_r1029159682
########## docker/hooks/build: ########## @@ -1,9 +1,13 @@ #!/bin/bash set -x -# When we build 'latest' tag we want to not override BK_VERSION variable +# When we build 'latest' tag we want always get the latest released version + if [[ "$DOCKER_TAG" = "latest" ]] then - docker build -t $IMAGE_NAME . + # GH API currently returns tags in the order they would be returned by the "git tag" command, which means they are alphabetically sorted. + # BK_RELEASE_VERSION points to the "highest" released version + BK_RELEASE_VERSION=`curl -s https://api.github.com/repos/apache/bookkeeper/tags | jq -r '.[0].name' | sed 's/release-\([0-9.]*\).*/\1/'` + docker build --build-arg BK_VERSION=$BK_RELEASE_VERSION -t $IMAGE_NAME:$BK_RELEASE_VERSION . Review Comment: The `IMAGE_NAME` is given from the docker hub Autobuild. See here: https://docs.docker.com/docker-hub/builds/advanced/#environment-variables-for-building-and-testing I think if the `DOCKER_TAG` is the `latest` we only want to build the image and tag it as `latest`, not the `4.15.3`. `apache/bookkeeper:4.15.3` will be built when we create the tag `release/4.15.3`. I am not sure what happened if you tag the image to the `4.15.3` and then the docker hub Autobuild wants the latest. `docker build --build-arg BK_VERSION=$BK_RELEASE_VERSION -t $IMAGE_NAME .` will always build the latest image with the latest release, that is your expectation , no? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
