From 529c0bfc1df9f9a1743ef48b28e4bc530cc93713 Mon Sep 17 00:00:00 2001 From: Vedant Pareek Date: Wed, 6 Nov 2024 19:10:06 +0530 Subject: [PATCH 1/3] Modified actions for supporting various kinds of tags --- .github/workflows/build-and-push-image.yaml | 42 +++++++++++++++++++-- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-push-image.yaml b/.github/workflows/build-and-push-image.yaml index e5b61e7..6345498 100644 --- a/.github/workflows/build-and-push-image.yaml +++ b/.github/workflows/build-and-push-image.yaml @@ -18,11 +18,43 @@ env: TAG_PREFIX: "v" jobs: + set_version_tags: + name: Set version tags + runs-on: ubuntu-latest + outputs: + version_tag: ${{ steps.set_version_tags.outputs.version_tag }} + jupyter_version_tag: ${{ steps.set_version_tags.outputs.jupyter_version_tag }} + alt_version_tag: ${{ steps.set_version_tags.outputs.alt_version_tag }} + steps: + - name: Set version tags + id: set_version_tags + run: | + echo "Ref name is ${{ github.ref_name }}" + echo "TAG_PREFIX is ${{ env.TAG_PREFIX }}" + + REF_NAME=${{ github.ref_name }} + TAG_PREFIX=${{ env.TAG_PREFIX }} + VERSION_TAG=$(echo $REF_NAME | awk -F$TAG_PREFIX '{print $2}') + echo "Setting VERSION_TAG to $VERSION_TAG" + echo "version_tag=$VERSION_TAG" >> $GITHUB_OUTPUT + + JUPYTER_VERSION_TAG=$(echo $REF_NAME | cut -d $TAG_PREFIX -f 2-)-jupyter + echo "Setting JUPYTER VERSION_TAG equal to JUPYTER_VERSION_TAG" + echo "jupyter_version_tag=JUPYTER_VERSION_TAG" >> $GITHUB_OUTPUT + + ALT_VERSION_TAG=$(echo $VERSION_TAG | awk -F- '{print $1}')-${GITHUB_SHA::7} + echo "Setting ALT_VERSION_TAG equal to $ALT_VERSION_TAG" + echo "alt_version_tag=$ALT_VERSION_TAG" >> $GITHUB_OUTPUT + build_image: name: Build uses: truefoundry/github-workflows-public/.github/workflows/build.yml@v0.1.2 with: - image_tag: "v${{ github.sha }}" + image_tag: "${{ github.sha }}" + extra_image_tag: | + ${{ needs.set_version_tags.outputs.version_tag }} + ${{ needs.set_version_tags.outputs.alt_version_tag }} + platforms: linux/amd64 image_artifact_name: llm-finetune artifactory_registry_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_REGISTRY_URL }} artifactory_repository_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_PUBLIC_REPOSITORY }} @@ -35,8 +67,12 @@ jobs: name: Build uses: truefoundry/github-workflows-public/.github/workflows/build.yml@v0.1.2 with: - image_tag: "v${{ github.sha }}" - image_artifact_name: llm-finetune-notebook + image_tag: "${{ github.sha }}" + extra_image_tag: | + ${{ needs.set_version_tags.outputs.version_tag }} + ${{ needs.set_version_tags.outputs.jupyter_version_tag }} + platforms: linux/amd64 + image_artifact_name: llm-finetune-jupyter artifactory_registry_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_REGISTRY_URL }} artifactory_repository_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_PUBLIC_REPOSITORY }} dockerfile_path: Dockerfile-notebook From 11141efc1944f37536578347a58179388d948441 Mon Sep 17 00:00:00 2001 From: Vedant Pareek Date: Wed, 6 Nov 2024 19:11:44 +0530 Subject: [PATCH 2/3] removed jupyter version tag --- .github/workflows/build-and-push-image.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/build-and-push-image.yaml b/.github/workflows/build-and-push-image.yaml index 6345498..43945f9 100644 --- a/.github/workflows/build-and-push-image.yaml +++ b/.github/workflows/build-and-push-image.yaml @@ -37,10 +37,6 @@ jobs: VERSION_TAG=$(echo $REF_NAME | awk -F$TAG_PREFIX '{print $2}') echo "Setting VERSION_TAG to $VERSION_TAG" echo "version_tag=$VERSION_TAG" >> $GITHUB_OUTPUT - - JUPYTER_VERSION_TAG=$(echo $REF_NAME | cut -d $TAG_PREFIX -f 2-)-jupyter - echo "Setting JUPYTER VERSION_TAG equal to JUPYTER_VERSION_TAG" - echo "jupyter_version_tag=JUPYTER_VERSION_TAG" >> $GITHUB_OUTPUT ALT_VERSION_TAG=$(echo $VERSION_TAG | awk -F- '{print $1}')-${GITHUB_SHA::7} echo "Setting ALT_VERSION_TAG equal to $ALT_VERSION_TAG" @@ -70,7 +66,7 @@ jobs: image_tag: "${{ github.sha }}" extra_image_tag: | ${{ needs.set_version_tags.outputs.version_tag }} - ${{ needs.set_version_tags.outputs.jupyter_version_tag }} + ${{ needs.set_version_tags.outputs.alt_version_tag }} platforms: linux/amd64 image_artifact_name: llm-finetune-jupyter artifactory_registry_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_REGISTRY_URL }} From 9e2e57c0e1dd8fb69f2ab4f6b47c9452c8ab031b Mon Sep 17 00:00:00 2001 From: Vedant Pareek Date: Wed, 6 Nov 2024 19:23:54 +0530 Subject: [PATCH 3/3] Added needs section and remove redundant image output --- .github/workflows/build-and-push-image.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-push-image.yaml b/.github/workflows/build-and-push-image.yaml index 43945f9..a848b7c 100644 --- a/.github/workflows/build-and-push-image.yaml +++ b/.github/workflows/build-and-push-image.yaml @@ -23,7 +23,6 @@ jobs: runs-on: ubuntu-latest outputs: version_tag: ${{ steps.set_version_tags.outputs.version_tag }} - jupyter_version_tag: ${{ steps.set_version_tags.outputs.jupyter_version_tag }} alt_version_tag: ${{ steps.set_version_tags.outputs.alt_version_tag }} steps: - name: Set version tags @@ -43,7 +42,8 @@ jobs: echo "alt_version_tag=$ALT_VERSION_TAG" >> $GITHUB_OUTPUT build_image: - name: Build + name: Build image + needs: set_version_tags uses: truefoundry/github-workflows-public/.github/workflows/build.yml@v0.1.2 with: image_tag: "${{ github.sha }}" @@ -60,7 +60,8 @@ jobs: artifactory_password: ${{ secrets.TRUEFOUNDRY_ARTIFACTORY_PUBLIC_PASSWORD }} build_notebook_image: - name: Build + name: Build notebook image + needs: set_version_tags uses: truefoundry/github-workflows-public/.github/workflows/build.yml@v0.1.2 with: image_tag: "${{ github.sha }}"