From 71c84bc0fb82c6fee5a25789687cc82f08793652 Mon Sep 17 00:00:00 2001 From: Kimonas Sotirchos Date: Fri, 11 Feb 2022 17:59:25 +0200 Subject: [PATCH 1/4] releasing: Create folder for handling releases Signed-off-by: Kimonas Sotirchos --- releasing/README.md | 18 ++++++++++++++++++ releasing/VERSION | 1 + 2 files changed, 19 insertions(+) create mode 100644 releasing/README.md create mode 100644 releasing/VERSION diff --git a/releasing/README.md b/releasing/README.md new file mode 100644 index 0000000..0230517 --- /dev/null +++ b/releasing/README.md @@ -0,0 +1,18 @@ +# Releasing + +This folder contains helper files for releasing the images and manifests of the +web app. + +## Steps for releasing + +1. Create a new release branch + ``` + VERSION="v0.7.0" + RELEASE_BRANCH="release-0.7" + git checkout -b $RELEASE_BRANCH origin/master + ``` +2. Update the VERSION file with the corresponding tag +3. Update the app's kustomization file to use the new tag +4. Submit the PR +5. Once merged the GH Action will tag and push an image based on the contents + of the VERSION file diff --git a/releasing/VERSION b/releasing/VERSION new file mode 100644 index 0000000..8b20e48 --- /dev/null +++ b/releasing/VERSION @@ -0,0 +1 @@ +v0.7.0 From cc891d2b04f730aea0a18c5b76d6adf606d0e4c3 Mon Sep 17 00:00:00 2001 From: Kimonas Sotirchos Date: Fri, 11 Feb 2022 18:21:51 +0200 Subject: [PATCH 2/4] gh: Add action for building from specific version Signed-off-by: Kimonas Sotirchos --- .../workflows/docker-publish-releasing.yml | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/docker-publish-releasing.yml diff --git a/.github/workflows/docker-publish-releasing.yml b/.github/workflows/docker-publish-releasing.yml new file mode 100644 index 0000000..68f8f67 --- /dev/null +++ b/.github/workflows/docker-publish-releasing.yml @@ -0,0 +1,58 @@ +name: Models web app Docker Publisher (Releasing) + +on: + push: + # Publish `master` as Docker `latest` image. + branches: + - master + + paths: + - releasing/VERSION + + # Run tests for any PRs. + pull_request: + +env: + IMAGE_NAME: models-web-app + +jobs: + # Run tests. + # See also https://docs.docker.com/docker-hub/builds/automated-testing/ + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Run tests + run: | + docker build . --file Dockerfile + # Push image to GitHub Packages. + # See also https://docs.docker.com/docker-hub/builds/ + push: + # Ensure test job passes before pushing image. + needs: test + + runs-on: ubuntu-latest + if: github.event_name == 'push' + + steps: + - uses: actions/checkout@v2 + + - name: Build image + run: | + docker build . --file Dockerfile --tag ${IMAGE_NAME} + - name: Log into registry + run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }} + + - name: Push image + run: | + IMAGE_ID=kserve/$IMAGE_NAME + # Change all uppercase to lowercase + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') + VERSION=$(echo ./releasing/VERSION) + + echo IMAGE_ID=$IMAGE_ID + echo VERSION=$VERSION + docker tag $IMAGE_NAME $IMAGE_ID:$VERSION + docker push $IMAGE_ID:$VERSION From ebf305f820f57864fe304fcf3e60f4b621cd4687 Mon Sep 17 00:00:00 2001 From: Kimonas Sotirchos Date: Mon, 14 Feb 2022 14:09:31 +0200 Subject: [PATCH 3/4] manfiests: Use specific tag Signed-off-by: Kimonas Sotirchos --- config/base/kustomization.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/base/kustomization.yaml b/config/base/kustomization.yaml index 5c8564c..8398272 100644 --- a/config/base/kustomization.yaml +++ b/config/base/kustomization.yaml @@ -6,6 +6,10 @@ resources: commonLabels: kustomize.component: kserve-models-web-app app.kubernetes.io/component: kserve-models-web-app +images: +- name: kserve/models-web-app + newName: kserve/models-web-app + newTag: v0.7.0 configMapGenerator: - name: kserve-models-web-app-config literals: From 45f6828350426f04004c17a15fd5465865552ff9 Mon Sep 17 00:00:00 2001 From: Kimonas Sotirchos Date: Mon, 14 Feb 2022 14:27:56 +0200 Subject: [PATCH 4/4] gh: Use cat for getting the tag Signed-off-by: Kimonas Sotirchos --- .github/workflows/docker-publish-releasing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish-releasing.yml b/.github/workflows/docker-publish-releasing.yml index 68f8f67..de44bbd 100644 --- a/.github/workflows/docker-publish-releasing.yml +++ b/.github/workflows/docker-publish-releasing.yml @@ -50,7 +50,7 @@ jobs: IMAGE_ID=kserve/$IMAGE_NAME # Change all uppercase to lowercase IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - VERSION=$(echo ./releasing/VERSION) + VERSION=$(cat ./releasing/VERSION) echo IMAGE_ID=$IMAGE_ID echo VERSION=$VERSION