diff --git a/.github/workflows/iroha2-profiling-image.yml b/.github/workflows/iroha2-custom-image.yml similarity index 70% rename from .github/workflows/iroha2-profiling-image.yml rename to .github/workflows/iroha2-custom-image.yml index 043bcd226c9..7eceb3d0511 100644 --- a/.github/workflows/iroha2-profiling-image.yml +++ b/.github/workflows/iroha2-custom-image.yml @@ -1,4 +1,4 @@ -name: I2::Profiling::Publish +name: I2::Custom::Publish on: push: @@ -14,6 +14,14 @@ on: options: - true - false + BUILD_ALPINE_IMAGE: + description: "Select \"true\" to build and push the alpine image from specific commit SHA" + type: choice + required: true + default: 'false' + options: + - true + - false CHECKOUT_REF: description: "The branch, tag or SHA to checkout" required: true @@ -39,6 +47,8 @@ jobs: timeout-minutes: 30 steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.CHECKOUT_REF }} - uses: Swatinem/rust-cache@v2 - name: Build iroha executor run: cargo run --bin iroha_wasm_builder -- build ./wasm_samples/default_executor --optimize --out-file ${{ env.DOCKER_COMPOSE_PATH }}/executor.wasm @@ -50,7 +60,7 @@ jobs: retention-days: 1 registry-profiling-image: - if: ${{ inputs.BUILD_GLIBC_IMAGE == 'false' }} + if: ${{ inputs.BUILD_GLIBC_IMAGE == 'false' }} and ${{ inputs.BUILD_ALPINE_IMAGE == 'false' }} runs-on: [self-hosted, Linux, iroha2] needs: build_executor container: @@ -102,7 +112,7 @@ jobs: context: . registry-glibc-image: - if: ${{ inputs.BUILD_GLIBC_IMAGE == 'true' }} + if: ${{ inputs.BUILD_GLIBC_IMAGE == 'true' }} and ${{ inputs.BUILD_ALPINE_IMAGE == 'false' }} runs-on: [self-hosted, Linux, iroha2] needs: build_executor container: @@ -128,7 +138,7 @@ jobs: uses: docker/setup-buildx-action@v3 with: install: true - - name: Build and push iroha2-profiling image + - name: Build and push iroha2-glibc image uses: docker/build-push-action@v6 if: always() with: @@ -137,3 +147,40 @@ jobs: labels: commit=${{ github.sha }} file: ${{env.IROHA2_DOCKERFILE }} context: . + + registry-alpine-image: + if: ${{ inputs.BUILD_GLIBC_IMAGE == 'false' }} and ${{ inputs.BUILD_ALPINE_IMAGE == 'true' }} + runs-on: [self-hosted, Linux, iroha2] + needs: build_executor + container: + image: hyperledger/iroha2-ci:nightly-2024-09-09 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.CHECKOUT_REF }} + - name: Download executor.wasm file + uses: actions/download-artifact@v4 + with: + name: executor.wasm + path: ${{ env.DOCKER_COMPOSE_PATH }} + - name: Login to Soramitsu Harbor + uses: docker/login-action@v3 + with: + registry: docker.soramitsu.co.jp + username: ${{ secrets.HARBOR_USERNAME }} + password: ${{ secrets.HARBOR_TOKEN }} + - name: Set up Docker Buildx + id: buildx + if: always() + uses: docker/setup-buildx-action@v3 + with: + install: true + - name: Build and push iroha2-alpine-sha image + uses: docker/build-push-action@v6 + if: always() + with: + push: true + tags: docker.soramitsu.co.jp/iroha2/iroha:${{ github.sha }} + labels: commit=${{ github.sha }} + file: Dockerfile + context: .