From 336e38bfc9d41ac32dbf4f89bfc9352336c6d3d5 Mon Sep 17 00:00:00 2001 From: ovsds Date: Tue, 19 Dec 2023 18:00:33 +0100 Subject: [PATCH 01/14] (BI-5142) fix: release builds --- .github/workflows/release.yaml | 17 ++--- .github/workflows/release_prerelease.yaml | 80 ++++++++++++++--------- 2 files changed, 58 insertions(+), 39 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 207e6ba38..f793ade26 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -34,10 +34,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} env: cr_url: "ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}" - image_url_base: "${{ env.cr_url }}/${{ matrix.image_name }}" - image_url_release: "${{ env.image_url_base }}:${{ github.event.inputs.version }}" - image_url_rc: "${{ env.image_url_base }}:${{ github.event.inputs.version }}rc1" - image_url_latest: "${{ env.image_url_base }}:latest" + image_url_rc: "$ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}/${{ matrix.image_name }}:${{ github.event.inputs.version }}rc1" steps: - name: Log in to the Container registry @@ -57,15 +54,19 @@ jobs: id: push_image run: | echo "Pushing release image" - docker tag ${{ env.image_url_rc }} ${{ env.image_url_release }} - docker push ${{ env.image_url_release }} + docker tag ${{ env.image_url_rc }} ${{ env.image_tag }} + docker push ${{ env.image_tag }} + env: + image_tag: "$${{ env.cr_url }}/${{ matrix.image_name }}:${{ github.event.inputs.version }}" - name: Push latest tag if: ${{ github.event.inputs.make_latest == 'true' }} run: | echo "Pushing latest image" - docker tag ${{ env.image_url_rc }} ${{ env.image_url_latest }} - docker push ${{ env.image_url_latest }} + docker tag ${{ env.image_url_rc }} ${{ env.image_tag }} + docker push ${{ env.image_tag }} + env: + image_tag: "$${{ env.cr_url }}/${{ matrix.image_name }}:latest" release: name: "Create release" diff --git a/.github/workflows/release_prerelease.yaml b/.github/workflows/release_prerelease.yaml index 455c2b825..8ec620829 100644 --- a/.github/workflows/release_prerelease.yaml +++ b/.github/workflows/release_prerelease.yaml @@ -24,8 +24,38 @@ on: default: false jobs: + get_version: + name: "Get version" + runs-on: ubuntu-latest + permissions: + contents: read + outputs: + version: ${{ steps.get_version.outputs.version }} + steps: + - name: Checkout code + id: checkout + uses: actions/checkout@v2 + with: + ref: "${{ github.event.inputs.branch }}" + fetch-depth: 0 + + - name: Get version + id: get_version + working-directory: .github/.scripts + run: | + version=${{ github.event.inputs.version }} + if [[ -z "${version}" ]]; then + latest_tag=$(git describe --tags --abbrev=0) + latest_version="${latest_tag%rc*}" + echo "Latest version is ${latest_version}" + version=$(./shift_version.sh ${latest_version} ${{ github.event.inputs.version_shift }}) + fi + + echo "version=${version}" >> $GITHUB_OUTPUT + build_images: name: "Build images" + needs: [get_version] runs-on: ubuntu-latest permissions: packages: write @@ -41,16 +71,14 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} env: + version: "${{ needs.get_version.outputs.version }}" cr_url: "ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}" - image_url_base: "${{ env.cr_url }}/${{ matrix.image_name }}" - image_url_rc: "${{ env.image_url_base }}:${{ github.event.inputs.version }}rc1" - image_url_release: "${{ env.image_url_base }}:${{ github.event.inputs.version }}" steps: - name: Log in to the Container registry uses: docker/login-action@v2 with: - registry: ${{ env.CR_TAG_BASE }} + registry: ${{ env.cr_url }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} @@ -58,7 +86,7 @@ jobs: id: checkout uses: actions/checkout@v2 with: - ref: "${{ env.branch }}" + ref: "${{ github.event.inputs.branch }}" fetch-depth: 0 - name: Build image @@ -71,13 +99,19 @@ jobs: --push \ --set "${bake_target}.tags=${{ env.image_url_rc }}" ${{ github.event.inputs.with_release == 'true' && '--set "${bake_target}.tags=${{ env.image_url_release }}"' || '' }} + env: + image_url_rc: "${{ env.cr_url }}/${{ matrix.image_name }}:${{ env.version }}rc1" + image_url_release: "${{ env.cr_url }}/${{ matrix.image_name }}:${{ env.version }}" release: name: "Create prerelease" - needs: [build_images] + needs: [build_images, get_version] runs-on: ubuntu-latest permissions: contents: write + env: + version: "${{ needs.get_version.outputs.version }}" + release_branch: "release/${{ needs.get_version.outputs.version }}" steps: - name: Checkout code id: checkout @@ -86,42 +120,25 @@ jobs: ref: "${{ github.event.inputs.branch }}" fetch-depth: 0 - - name: Get version - id: get_version - working-directory: .github/.scripts - run: | - version=${{ github.event.inputs.version }} - if [[ -z "${version}" ]]; then - latest_tag=$(git describe --tags --abbrev=0) - latest_version="${latest_tag%rc*}" - echo "Latest version is ${latest_version}" - version=$(./shift_version.sh ${latest_version} ${{ github.event.inputs.version_shift }}) - fi - release_branch="release/${version}" - tag_name="${version}rc1" - - echo "version=${version}" >> $GITHUB_OUTPUT - echo "release_branch=${release_branch}" >> $GITHUB_OUTPUT - echo "tag_name=${tag_name}" >> $GITHUB_OUTPUT - - name: Create and push release branch id: create_branch - if: ${{ github.event.inputs.branch != steps.get_version.outputs.release_branch }} + if: ${{ github.event.inputs.branch != env.release_branch }} run: | - git branch ${{ steps.get_version.outputs.release_branch }} - git push origin ${{ steps.get_version.outputs.release_branch }} + git branch ${{ env.release_branch }} + git push origin ${{ env.release_branch }} - name: Create prerelease id: create_prerelease run: | gh release create \ --repo ${{ github.repository_owner }}/${{ github.event.repository.name }} \ - ${{ steps.get_version.outputs.tag_name }} \ - --target ${{ steps.get_version.outputs.release_branch }} \ + ${{ env.release_tag }} \ + --target ${{ env.release_branch }} \ --prerelease \ --generate-notes env: GH_TOKEN: ${{ github.token }} + release_tag: "${{ env.version }}rc1" - name: Create release id: create_release @@ -129,8 +146,9 @@ jobs: run: | gh release create \ --repo ${{ github.repository_owner }}/${{ github.event.repository.name }} \ - ${{ steps.get_version.outputs.version }} \ - --target ${{ steps.get_version.outputs.release_branch }} \ + ${{ env.release_tag }} \ + --target ${{ env.release_branch }} \ --generate-notes env: GH_TOKEN: ${{ github.token }} + release_tag: "${{ env.version }}" From 64459fc0e1025c6d545bc5f3a21c0d810a209a69 Mon Sep 17 00:00:00 2001 From: ovsds Date: Tue, 19 Dec 2023 18:04:48 +0100 Subject: [PATCH 02/14] (BI-5142) fix: release builds --- .github/workflows/release_prerelease.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_prerelease.yaml b/.github/workflows/release_prerelease.yaml index 8ec620829..273e8b648 100644 --- a/.github/workflows/release_prerelease.yaml +++ b/.github/workflows/release_prerelease.yaml @@ -93,7 +93,7 @@ jobs: working-directory: docker_build run: | image_name="${{ matrix.image_name }}" - bake_target="${image_name/-/_}" # replace - with _ + bake_target="${image_name//-/_}" ./run-project-bake "${bake_target}" \ --push \ From a3fea38756970d26341c0d12c6545cd5be2c1b23 Mon Sep 17 00:00:00 2001 From: ovsds Date: Tue, 19 Dec 2023 18:11:44 +0100 Subject: [PATCH 03/14] (BI-5142) fix: release builds --- .github/workflows/release_prerelease.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release_prerelease.yaml b/.github/workflows/release_prerelease.yaml index 273e8b648..31b80734e 100644 --- a/.github/workflows/release_prerelease.yaml +++ b/.github/workflows/release_prerelease.yaml @@ -95,6 +95,9 @@ jobs: image_name="${{ matrix.image_name }}" bake_target="${image_name//-/_}" + echo "Building image ${image_name}" + echo "Bake target ${bake_target}" + ./run-project-bake "${bake_target}" \ --push \ --set "${bake_target}.tags=${{ env.image_url_rc }}" From 61d9f75c43e3b8dd65f8e6c41b83e9352befa923 Mon Sep 17 00:00:00 2001 From: ovsds Date: Tue, 19 Dec 2023 18:12:39 +0100 Subject: [PATCH 04/14] (BI-5142) fix: release builds --- .github/workflows/release_prerelease.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release_prerelease.yaml b/.github/workflows/release_prerelease.yaml index 31b80734e..a8d309234 100644 --- a/.github/workflows/release_prerelease.yaml +++ b/.github/workflows/release_prerelease.yaml @@ -34,6 +34,7 @@ jobs: steps: - name: Checkout code id: checkout + if: ${{ github.event.inputs.version == '' }} uses: actions/checkout@v2 with: ref: "${{ github.event.inputs.branch }}" From 1603ae5ff878b923e3bd757035d9c4e3d70b715b Mon Sep 17 00:00:00 2001 From: ovsds Date: Tue, 19 Dec 2023 18:14:47 +0100 Subject: [PATCH 05/14] (BI-5142) fix: release builds --- .github/workflows/release_prerelease.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/release_prerelease.yaml b/.github/workflows/release_prerelease.yaml index a8d309234..f7c0d240a 100644 --- a/.github/workflows/release_prerelease.yaml +++ b/.github/workflows/release_prerelease.yaml @@ -42,14 +42,13 @@ jobs: - name: Get version id: get_version - working-directory: .github/.scripts run: | version=${{ github.event.inputs.version }} if [[ -z "${version}" ]]; then latest_tag=$(git describe --tags --abbrev=0) latest_version="${latest_tag%rc*}" echo "Latest version is ${latest_version}" - version=$(./shift_version.sh ${latest_version} ${{ github.event.inputs.version_shift }}) + version=$(.github/.scripts/shift_version.sh ${latest_version} ${{ github.event.inputs.version_shift }}) fi echo "version=${version}" >> $GITHUB_OUTPUT From 918e9b0cb7b4e9f111eb9efa4a25c175f6a06988 Mon Sep 17 00:00:00 2001 From: ovsds Date: Tue, 19 Dec 2023 18:19:07 +0100 Subject: [PATCH 06/14] (BI-5142) fix: release builds --- .github/workflows/release_prerelease.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_prerelease.yaml b/.github/workflows/release_prerelease.yaml index f7c0d240a..3e6c8a2af 100644 --- a/.github/workflows/release_prerelease.yaml +++ b/.github/workflows/release_prerelease.yaml @@ -93,7 +93,7 @@ jobs: working-directory: docker_build run: | image_name="${{ matrix.image_name }}" - bake_target="${image_name//-/_}" + bake_target="${image_name//"-"/"_"}" echo "Building image ${image_name}" echo "Bake target ${bake_target}" From a582d866b1d00d71bdb2ceaa3136af47e1a5a8f5 Mon Sep 17 00:00:00 2001 From: ovsds Date: Tue, 19 Dec 2023 18:21:08 +0100 Subject: [PATCH 07/14] (BI-5142) fix: release builds --- .github/workflows/release_prerelease.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_prerelease.yaml b/.github/workflows/release_prerelease.yaml index 3e6c8a2af..a76ebcd4d 100644 --- a/.github/workflows/release_prerelease.yaml +++ b/.github/workflows/release_prerelease.yaml @@ -93,7 +93,7 @@ jobs: working-directory: docker_build run: | image_name="${{ matrix.image_name }}" - bake_target="${image_name//"-"/"_"}" + bake_target=$(sed "s/-/_/g" <<< "$image_name") echo "Building image ${image_name}" echo "Bake target ${bake_target}" From 675385f6e9f225075ee71313db5d94f7817a3715 Mon Sep 17 00:00:00 2001 From: ovsds Date: Tue, 19 Dec 2023 18:25:05 +0100 Subject: [PATCH 08/14] (BI-5142) fix: release builds --- .github/workflows/release_prerelease.yaml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release_prerelease.yaml b/.github/workflows/release_prerelease.yaml index a76ebcd4d..96e6da04c 100644 --- a/.github/workflows/release_prerelease.yaml +++ b/.github/workflows/release_prerelease.yaml @@ -61,9 +61,11 @@ jobs: packages: write strategy: matrix: - image_name: - - "dl-control-api" - - "dl-data-api" + include: + - image_name: "dl-control-api" + bake_target: "dl_control_api" + - image_name: "dl-data-api" + bake_target: "dl_data_api" container: image: "ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}/debian_docker:latest" options: -v /var/run/docker.sock:/var/run/docker.sock @@ -92,11 +94,7 @@ jobs: - name: Build image working-directory: docker_build run: | - image_name="${{ matrix.image_name }}" - bake_target=$(sed "s/-/_/g" <<< "$image_name") - - echo "Building image ${image_name}" - echo "Bake target ${bake_target}" + bake_target=${{ matrix.bake_target }} ./run-project-bake "${bake_target}" \ --push \ From 0011effb45a299c436bb644e804f0428e2fb0eb0 Mon Sep 17 00:00:00 2001 From: ovsds Date: Tue, 19 Dec 2023 18:34:05 +0100 Subject: [PATCH 09/14] (BI-5142) fix: release builds --- .github/workflows/release.yaml | 8 ++++---- .github/workflows/release_prerelease.yaml | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f793ade26..feed34ff0 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -24,8 +24,8 @@ jobs: strategy: matrix: image_name: - - "dl-control-api" - - "dl-data-api" + - "datalens-control-api" + - "datalens-data-api" container: image: "ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}/debian_docker:latest" options: -v /var/run/docker.sock:/var/run/docker.sock @@ -33,8 +33,8 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} env: - cr_url: "ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}" - image_url_rc: "$ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}/${{ matrix.image_name }}:${{ github.event.inputs.version }}rc1" + cr_url: "ghcr.io/${{ github.repository_owner }}" + image_url_rc: "$ghcr.io/${{ github.repository_owner }}/${{ matrix.image_name }}:${{ github.event.inputs.version }}rc1" steps: - name: Log in to the Container registry diff --git a/.github/workflows/release_prerelease.yaml b/.github/workflows/release_prerelease.yaml index 96e6da04c..b469ea0e2 100644 --- a/.github/workflows/release_prerelease.yaml +++ b/.github/workflows/release_prerelease.yaml @@ -62,9 +62,9 @@ jobs: strategy: matrix: include: - - image_name: "dl-control-api" + - image_name: "datalens-control-api" bake_target: "dl_control_api" - - image_name: "dl-data-api" + - image_name: "datalens-data-api" bake_target: "dl_data_api" container: image: "ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}/debian_docker:latest" @@ -74,7 +74,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} env: version: "${{ needs.get_version.outputs.version }}" - cr_url: "ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}" + cr_url: "ghcr.io/${{ github.repository_owner }}" steps: - name: Log in to the Container registry From e08ba16fd49dc23f0bf3608f470380f519c1ec4c Mon Sep 17 00:00:00 2001 From: ovsds Date: Tue, 19 Dec 2023 18:38:35 +0100 Subject: [PATCH 10/14] (BI-5142) fix: release builds --- .github/workflows/release.yaml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index feed34ff0..9a7664b93 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -59,15 +59,6 @@ jobs: env: image_tag: "$${{ env.cr_url }}/${{ matrix.image_name }}:${{ github.event.inputs.version }}" - - name: Push latest tag - if: ${{ github.event.inputs.make_latest == 'true' }} - run: | - echo "Pushing latest image" - docker tag ${{ env.image_url_rc }} ${{ env.image_tag }} - docker push ${{ env.image_tag }} - env: - image_tag: "$${{ env.cr_url }}/${{ matrix.image_name }}:latest" - release: name: "Create release" needs: [push_images] From 665b1cc11b92a10cbae919d672539ac746738755 Mon Sep 17 00:00:00 2001 From: ovsds Date: Tue, 19 Dec 2023 18:43:41 +0100 Subject: [PATCH 11/14] (BI-5142) fix: release builds --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 9a7664b93..ee1c69885 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -40,7 +40,7 @@ jobs: - name: Log in to the Container registry uses: docker/login-action@v2 with: - registry: ${{ env.CR_TAG_BASE }} + registry: ${{ env.cr_url }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} From 77bc7b377a855b6426bb5aa44af746692a36633a Mon Sep 17 00:00:00 2001 From: ovsds Date: Tue, 19 Dec 2023 18:51:26 +0100 Subject: [PATCH 12/14] (BI-5142) fix: release builds --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index ee1c69885..30dc5d905 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -34,7 +34,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} env: cr_url: "ghcr.io/${{ github.repository_owner }}" - image_url_rc: "$ghcr.io/${{ github.repository_owner }}/${{ matrix.image_name }}:${{ github.event.inputs.version }}rc1" + image_url_rc: "ghcr.io/${{ github.repository_owner }}/${{ matrix.image_name }}:${{ github.event.inputs.version }}rc1" steps: - name: Log in to the Container registry From 5a644119f9120d341f140663b81a1ba8393e47e8 Mon Sep 17 00:00:00 2001 From: ovsds Date: Tue, 19 Dec 2023 18:52:58 +0100 Subject: [PATCH 13/14] (BI-5142) fix: release builds --- .github/workflows/release.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 30dc5d905..2bea65369 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -26,12 +26,6 @@ jobs: image_name: - "datalens-control-api" - "datalens-data-api" - container: - image: "ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}/debian_docker:latest" - options: -v /var/run/docker.sock:/var/run/docker.sock - credentials: - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} env: cr_url: "ghcr.io/${{ github.repository_owner }}" image_url_rc: "ghcr.io/${{ github.repository_owner }}/${{ matrix.image_name }}:${{ github.event.inputs.version }}rc1" From cbdfcbd6131c2ba6f81b7864ea8fc9f1eb845977 Mon Sep 17 00:00:00 2001 From: ovsds Date: Tue, 19 Dec 2023 18:58:55 +0100 Subject: [PATCH 14/14] (BI-5142) fix: release builds --- .github/workflows/release.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 2bea65369..51422b732 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -48,10 +48,10 @@ jobs: id: push_image run: | echo "Pushing release image" - docker tag ${{ env.image_url_rc }} ${{ env.image_tag }} - docker push ${{ env.image_tag }} + docker tag "${{ env.image_url_rc }}" "${{ env.image_tag }}" + docker push "${{ env.image_tag }}" env: - image_tag: "$${{ env.cr_url }}/${{ matrix.image_name }}:${{ github.event.inputs.version }}" + image_tag: "${{ env.cr_url }}/${{ matrix.image_name }}:${{ github.event.inputs.version }}" release: name: "Create release"