From 7d260a6c486564d40bf6d10344a1017bc93292a3 Mon Sep 17 00:00:00 2001 From: Verin1005 Date: Wed, 6 Dec 2023 16:20:15 +0800 Subject: [PATCH 01/40] add worker && cli build --- .github/workflows/create-release-draft.yml | 478 +++++++++++---------- 1 file changed, 250 insertions(+), 228 deletions(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index a9e621f000..5a9d812604 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -26,6 +26,9 @@ on: release_tag: description: an existing tag for creating release (e.g. v1.2.3) required: true + release_worker_tag: + description: an existing tag for creating release (e.g. v1.2.3) + required: true diff_tag: description: an existing tag to run diff against (e.g. v1.2.0) default: "" @@ -41,6 +44,7 @@ on: env: RELEASE_TAG: ${{ github.event.inputs.release_tag }} + RELEASE_WORKER_TAG: ${{ github.event.inputs.release_worker_tag }} DIFF_TAG: ${{ github.event.inputs.diff_tag }} GENESIS_RELEASE: ${{ github.event.inputs.genesis_release }} DOCKER_BUILDKIT: 1 @@ -136,237 +140,255 @@ jobs: echo "=============================" docker images - - name: Dockerhub login - uses: docker/login-action@v3 + - name: Build worker + uses: docker/build-push-action@v5 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} + context: . + file: tee-worker/build.Dockerfile + tags: litentry/litentry-worker:${{env.RELEASE_WORKER_TAG}} + target: deployed-worker - - name: Push docker image - run: | - docker push litentry/litentry-parachain:$DOCKER_TAG - - - name: Generate genesis artefacts if need - if: github.event.inputs.genesis_release != 'none' - run: | - docker run --rm litentry/litentry-parachain:$DOCKER_TAG export-genesis-state --chain=${{ env.GENESIS_RELEASE }} > ${{ env.GENESIS_RELEASE }}-genesis-state - docker run --rm litentry/litentry-parachain:$DOCKER_TAG export-genesis-wasm --chain=${{ env.GENESIS_RELEASE }} > ${{ env.GENESIS_RELEASE }}-genesis-wasm - - - name: Copy client binary to disk - run: | - docker cp $(docker create --rm litentry/litentry-parachain:$DOCKER_TAG):/usr/local/bin/litentry-collator . - - - name: Upload the client binary - uses: actions/upload-artifact@v3 + - name: Build cli + uses: docker/build-push-action@v5 with: - name: litentry-collator - if-no-files-found: ignore - path: | - litentry-collator - ${{ env.GENESIS_RELEASE }}-genesis-state - ${{ env.GENESIS_RELEASE }}-genesis-wasm - - ## Build the enclave and package config files - build-tee: - if: ${{ github.event.inputs.release_worker == 'true' }} || ${{ github.event.inputs.release_enclave == 'true' }} - runs-on: tee-prod-builder - outputs: - mrenclave: ${{ steps.mrenclave.outputs.mrenclave }} - enclave_sha1sum: ${{ steps.shasum.outputs.enclave_sha1sum }} - worker_sha1sum: ${{ steps.shasum.outputs.worker_sha1sum }} - steps: - - name: Checkout codes on ${{ env.RELEASE_TAG }} - uses: actions/checkout@v4 - with: - ref: ${{ env.RELEASE_TAG }} - fetch-depth: 0 - - - name: Build release artefacts - run: | - source /opt/intel/sgxsdk/environment - ./tee-worker/scripts/litentry/release/build.sh ${{ github.event.inputs.release_worker }} ${{ github.event.inputs.release_enclave }} - - - name: Set MRENCLAVE - id: mrenclave - run: | - MRENCLAVE= - f="tee-worker/enclave_release/mrenclave.txt" - [ -f "$f" ] && MRENCLAVE=$(cat "$f") - echo "mrenclave=$MRENCLAVE" >> $GITHUB_OUTPUT - - - name: Set shasum - id: shasum - run: | - ENCLAVE_SHA1SUM= - WORKER_SHA1SUM= - cd tee-worker/enclave_release - [ -f "enclave.signed.so" ] && ENCLAVE_SHA1SUM=$(shasum enclave.signed.so | awk '{print $1}') - [ -f "litentry-worker" ] && WORKER_SHA1SUM=$(shasum litentry-worker | awk '{print $1}') - echo "enclave_sha1sum=$ENCLAVE_SHA1SUM" >> $GITHUB_OUTPUT - echo "worker_sha1sum=$WORKER_SHA1SUM" >> $GITHUB_OUTPUT - - - name: Upload artefacts - uses: actions/upload-artifact@v3 - with: - name: litentry-tee - path: ./tee-worker/enclave_release/* - - - name: Fail early - if: failure() - uses: andymckay/cancel-action@0.3 + context: . + file: tee-worker/build.Dockerfile + tags: litentry/litentry-cli:${{env.RELEASE_WORKER_TAG}} + target: deployed-client + + - run: docker images --all + + # - name: Dockerhub login + # uses: docker/login-action@v3 + # with: + # username: ${{ secrets.DOCKERHUB_USERNAME }} + # password: ${{ secrets.DOCKERHUB_PASSWORD }} + + # - name: Push docker image + # run: | + # docker push litentry/litentry-parachain:$DOCKER_TAG + + # - name: Generate genesis artefacts if need + # if: github.event.inputs.genesis_release != 'none' + # run: | + # docker run --rm litentry/litentry-parachain:$DOCKER_TAG export-genesis-state --chain=${{ env.GENESIS_RELEASE }} > ${{ env.GENESIS_RELEASE }}-genesis-state + # docker run --rm litentry/litentry-parachain:$DOCKER_TAG export-genesis-wasm --chain=${{ env.GENESIS_RELEASE }} > ${{ env.GENESIS_RELEASE }}-genesis-wasm + + # - name: Copy client binary to disk + # run: | + # docker cp $(docker create --rm litentry/litentry-parachain:$DOCKER_TAG):/usr/local/bin/litentry-collator . + + # - name: Upload the client binary + # uses: actions/upload-artifact@v3 + # with: + # name: litentry-collator + # if-no-files-found: ignore + # path: | + # litentry-collator + # ${{ env.GENESIS_RELEASE }}-genesis-state + # ${{ env.GENESIS_RELEASE }}-genesis-wasm + + # ## Build the enclave and package config files + # build-tee: + # if: ${{ github.event.inputs.release_worker == 'true' }} || ${{ github.event.inputs.release_enclave == 'true' }} + # runs-on: tee-prod-builder + # outputs: + # mrenclave: ${{ steps.mrenclave.outputs.mrenclave }} + # enclave_sha1sum: ${{ steps.shasum.outputs.enclave_sha1sum }} + # worker_sha1sum: ${{ steps.shasum.outputs.worker_sha1sum }} + # steps: + # - name: Checkout codes on ${{ env.RELEASE_TAG }} + # uses: actions/checkout@v4 + # with: + # ref: ${{ env.RELEASE_TAG }} + # fetch-depth: 0 + + # - name: Build release artefacts + # run: | + # source /opt/intel/sgxsdk/environment + # ./tee-worker/scripts/litentry/release/build.sh ${{ github.event.inputs.release_worker }} ${{ github.event.inputs.release_enclave }} + + # - name: Set MRENCLAVE + # id: mrenclave + # run: | + # MRENCLAVE= + # f="tee-worker/enclave_release/mrenclave.txt" + # [ -f "$f" ] && MRENCLAVE=$(cat "$f") + # echo "mrenclave=$MRENCLAVE" >> $GITHUB_OUTPUT + + # - name: Set shasum + # id: shasum + # run: | + # ENCLAVE_SHA1SUM= + # WORKER_SHA1SUM= + # cd tee-worker/enclave_release + # [ -f "enclave.signed.so" ] && ENCLAVE_SHA1SUM=$(shasum enclave.signed.so | awk '{print $1}') + # [ -f "litentry-worker" ] && WORKER_SHA1SUM=$(shasum litentry-worker | awk '{print $1}') + # echo "enclave_sha1sum=$ENCLAVE_SHA1SUM" >> $GITHUB_OUTPUT + # echo "worker_sha1sum=$WORKER_SHA1SUM" >> $GITHUB_OUTPUT + + # - name: Upload artefacts + # uses: actions/upload-artifact@v3 + # with: + # name: litentry-tee + # path: ./tee-worker/enclave_release/* + + # - name: Fail early + # if: failure() + # uses: andymckay/cancel-action@0.3 - ## test again the built docker image ## - run-ts-tests: - runs-on: ubuntu-latest - needs: build-docker - strategy: - matrix: - chain: - - litmus - - litentry - steps: - - name: Checkout codes - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Enable corepack and pnpm - run: corepack enable && corepack enable pnpm - - - name: Download and tag docker image - run: | - export DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') - docker pull litentry/litentry-parachain:$DOCKER_TAG - docker tag litentry/litentry-parachain:$DOCKER_TAG litentry/litentry-parachain:latest - - - name: Run ts tests for ${{ matrix.chain }} - timeout-minutes: 20 - run: | - make test-ts-docker-${{ matrix.chain }} - - - name: Archive logs if test fails - uses: actions/upload-artifact@v3 - if: ${{ failure() }} - with: - name: ${{ matrix.chain }}-ts-tests-artifacts - path: /tmp/parachain_dev/ - retention-days: 3 - - - name: Clean up for ${{ matrix.chain }} - if: ${{ always() }} - run: | - make clean-docker-${{ matrix.chain }} - - ## check extrinsic ## - extrinsic-ordering-check-from-bin: - runs-on: ubuntu-latest - needs: build-docker - strategy: - matrix: - chain: [rococo, litmus, litentry] - include: - - chain: rococo - ref_url: wss://rpc.rococo-parachain-sg.litentry.io - - chain: litmus - ref_url: wss://rpc.litmus-parachain.litentry.io - - chain: litentry - ref_url: wss://rpc.litentry-parachain.litentry.io - steps: - - name: Checkout sources - uses: actions/checkout@v4 - with: - ref: ${{ env.RELEASE_TAG }} - - - name: Prepare output and compare the metadata - timeout-minutes: 3 - run: | - export DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') - PARACHAIN_NAME=local-parachain - BASE_URL=ws://127.0.0.1:9944 - chain=${{ matrix.chain }} - REF_URL=${{ matrix.ref_url }} - echo "Metadata comparison:" > output-$chain.txt - echo "Date: $(date)" >> output-$chain.txt - echo "Base: $BASE_URL" >> output-$chain.txt - echo "Reference: $REF_URL" >> output-$chain.txt - echo "Target Tag: ${{ env.RELEASE_TAG }}" >> output-$chain.txt - echo "Chain: $chain" >> output-$chain.txt - echo "----------------------------------------------------------------------" >> output-$chain.txt - echo "Running parachain: $chain" - docker run --pull always --rm --name=$PARACHAIN_NAME -d -p 9944:9944 litentry/litentry-parachain:$DOCKER_TAG --chain=$chain-dev --rpc-cors=all --ws-external --tmp -- --dev - sleep 3 - CMD="docker run --pull always --network host jacogr/polkadot-js-tools metadata $REF_URL $BASE_URL" - echo -e "Running:\n$CMD" - docker run --pull always --rm --network host jacogr/polkadot-js-tools metadata $REF_URL $BASE_URL | tee -a output-$chain.txt - SUMMARY=$(./scripts/extrinsic-ordering-filter.sh output-$chain.txt) - echo -e $SUMMARY >> output-$chain.txt - docker stop $PARACHAIN_NAME - content=$(< output-$chain.txt) - echo "content<> $GITHUB_ENV - echo "$content" >> $GITHUB_ENV - echo "EOF" >> $GITHUB_ENV - - - name: Find issues - uses: actions-cool/issues-helper@v3 - id: findissueid - with: - actions: 'find-issues' - token: ${{ secrets.GITHUB_TOKEN }} - issue-state: 'open' - title-includes: Litentry-parachain ${{ env.RELEASE_TAG }} Release checklist + # ## test again the built docker image ## + # run-ts-tests: + # runs-on: ubuntu-latest + # needs: build-docker + # strategy: + # matrix: + # chain: + # - litmus + # - litentry + # steps: + # - name: Checkout codes + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + + # - name: Enable corepack and pnpm + # run: corepack enable && corepack enable pnpm + + # - name: Download and tag docker image + # run: | + # export DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') + # docker pull litentry/litentry-parachain:$DOCKER_TAG + # docker tag litentry/litentry-parachain:$DOCKER_TAG litentry/litentry-parachain:latest + + # - name: Run ts tests for ${{ matrix.chain }} + # timeout-minutes: 20 + # run: | + # make test-ts-docker-${{ matrix.chain }} + + # - name: Archive logs if test fails + # uses: actions/upload-artifact@v3 + # if: ${{ failure() }} + # with: + # name: ${{ matrix.chain }}-ts-tests-artifacts + # path: /tmp/parachain_dev/ + # retention-days: 3 + + # - name: Clean up for ${{ matrix.chain }} + # if: ${{ always() }} + # run: | + # make clean-docker-${{ matrix.chain }} + + # ## check extrinsic ## + # extrinsic-ordering-check-from-bin: + # runs-on: ubuntu-latest + # needs: build-docker + # strategy: + # matrix: + # chain: [rococo, litmus, litentry] + # include: + # - chain: rococo + # ref_url: wss://rpc.rococo-parachain-sg.litentry.io + # - chain: litmus + # ref_url: wss://rpc.litmus-parachain.litentry.io + # - chain: litentry + # ref_url: wss://rpc.litentry-parachain.litentry.io + # steps: + # - name: Checkout sources + # uses: actions/checkout@v4 + # with: + # ref: ${{ env.RELEASE_TAG }} + + # - name: Prepare output and compare the metadata + # timeout-minutes: 3 + # run: | + # export DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') + # PARACHAIN_NAME=local-parachain + # BASE_URL=ws://127.0.0.1:9944 + # chain=${{ matrix.chain }} + # REF_URL=${{ matrix.ref_url }} + # echo "Metadata comparison:" > output-$chain.txt + # echo "Date: $(date)" >> output-$chain.txt + # echo "Base: $BASE_URL" >> output-$chain.txt + # echo "Reference: $REF_URL" >> output-$chain.txt + # echo "Target Tag: ${{ env.RELEASE_TAG }}" >> output-$chain.txt + # echo "Chain: $chain" >> output-$chain.txt + # echo "----------------------------------------------------------------------" >> output-$chain.txt + # echo "Running parachain: $chain" + # docker run --pull always --rm --name=$PARACHAIN_NAME -d -p 9944:9944 litentry/litentry-parachain:$DOCKER_TAG --chain=$chain-dev --rpc-cors=all --ws-external --tmp -- --dev + # sleep 3 + # CMD="docker run --pull always --network host jacogr/polkadot-js-tools metadata $REF_URL $BASE_URL" + # echo -e "Running:\n$CMD" + # docker run --pull always --rm --network host jacogr/polkadot-js-tools metadata $REF_URL $BASE_URL | tee -a output-$chain.txt + # SUMMARY=$(./scripts/extrinsic-ordering-filter.sh output-$chain.txt) + # echo -e $SUMMARY >> output-$chain.txt + # docker stop $PARACHAIN_NAME + # content=$(< output-$chain.txt) + # echo "content<> $GITHUB_ENV + # echo "$content" >> $GITHUB_ENV + # echo "EOF" >> $GITHUB_ENV + + # - name: Find issues + # uses: actions-cool/issues-helper@v3 + # id: findissueid + # with: + # actions: 'find-issues' + # token: ${{ secrets.GITHUB_TOKEN }} + # issue-state: 'open' + # title-includes: Litentry-parachain ${{ env.RELEASE_TAG }} Release checklist - - name: Create comment - if: ${{ steps.findissueid.outputs.issues }} != '[]' - uses: actions-cool/issues-helper@v3 - with: - actions: 'create-comment' - token: ${{ secrets.GITHUB_TOKEN }} - issue-number: ${{ fromJson(steps.findissueid.outputs.issues)[0].number }} - body: | - ${{ env.content }} - - ## create the release draft ## - create-release-draft: - runs-on: ubuntu-latest - # see https://github.com/actions/runner/issues/491 - # seems to be the only way to achieve this - needs: - - set-release-type - - build-tee - - run-ts-tests - - build-wasm - if: | - !failure() && - (success('build-wasm') || success('run-ts-tests') || success('build-tee')) - steps: - - name: Checkout codes on ${{ env.RELEASE_TAG }} - uses: actions/checkout@v4 - with: - ref: ${{ env.RELEASE_TAG }} - fetch-depth: 0 - - - name: Download all artefacts - uses: actions/download-artifact@v3 + # - name: Create comment + # if: ${{ steps.findissueid.outputs.issues }} != '[]' + # uses: actions-cool/issues-helper@v3 + # with: + # actions: 'create-comment' + # token: ${{ secrets.GITHUB_TOKEN }} + # issue-number: ${{ fromJson(steps.findissueid.outputs.issues)[0].number }} + # body: | + # ${{ env.content }} + + # ## create the release draft ## + # create-release-draft: + # runs-on: ubuntu-latest + # # see https://github.com/actions/runner/issues/491 + # # seems to be the only way to achieve this + # needs: + # - set-release-type + # - build-tee + # - run-ts-tests + # - build-wasm + # if: | + # !failure() && + # (success('build-wasm') || success('run-ts-tests') || success('build-tee')) + # steps: + # - name: Checkout codes on ${{ env.RELEASE_TAG }} + # uses: actions/checkout@v4 + # with: + # ref: ${{ env.RELEASE_TAG }} + # fetch-depth: 0 + + # - name: Download all artefacts + # uses: actions/download-artifact@v3 - - name: Generate release notes - run: | - export MRENCLAVE="${{ needs.build-tee.outputs.mrenclave }}" - export ENCLAVE_SHA1SUM="${{ needs.build-tee.outputs.enclave_sha1sum }}" - export WORKER_SHA1SUM="${{ needs.build-tee.outputs.worker_sha1sum }}" - ./scripts/generate-release-notes.sh ${{ github.workspace }}/.github/release_notes.md ${{ needs.set-release-type.outputs.release_type }} ${{ env.DIFF_TAG }} - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Create release draft - id: create-release-draft - uses: softprops/action-gh-release@v1 - with: - tag_name: ${{ env.RELEASE_TAG }} - name: Litentry-parachain ${{ env.RELEASE_TAG }} - body_path: ${{ github.workspace }}/.github/release_notes.md - draft: true - files: | - *-parachain-runtime/*-parachain-srtool-digest.json - *-parachain-runtime/*-parachain-runtime.compact.compressed.wasm - litentry-collator/* - litentry-tee/* + # - name: Generate release notes + # run: | + # export MRENCLAVE="${{ needs.build-tee.outputs.mrenclave }}" + # export ENCLAVE_SHA1SUM="${{ needs.build-tee.outputs.enclave_sha1sum }}" + # export WORKER_SHA1SUM="${{ needs.build-tee.outputs.worker_sha1sum }}" + # ./scripts/generate-release-notes.sh ${{ github.workspace }}/.github/release_notes.md ${{ needs.set-release-type.outputs.release_type }} ${{ env.DIFF_TAG }} + # env: + # GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # - name: Create release draft + # id: create-release-draft + # uses: softprops/action-gh-release@v1 + # with: + # tag_name: ${{ env.RELEASE_TAG }} + # name: Litentry-parachain ${{ env.RELEASE_TAG }} + # body_path: ${{ github.workspace }}/.github/release_notes.md + # draft: true + # files: | + # *-parachain-runtime/*-parachain-srtool-digest.json + # *-parachain-runtime/*-parachain-runtime.compact.compressed.wasm + # litentry-collator/* + # litentry-tee/* From eb2b57f3d41938cff157347a0180d40407d3768a Mon Sep 17 00:00:00 2001 From: Verin1005 Date: Wed, 6 Dec 2023 16:57:52 +0800 Subject: [PATCH 02/40] separate docker builds --- .github/workflows/create-release-draft.yml | 71 ++++++++++++---------- 1 file changed, 40 insertions(+), 31 deletions(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index 5a9d812604..0ccbd4ef7a 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -140,6 +140,46 @@ jobs: echo "=============================" docker images + # - name: Dockerhub login + # uses: docker/login-action@v3 + # with: + # username: ${{ secrets.DOCKERHUB_USERNAME }} + # password: ${{ secrets.DOCKERHUB_PASSWORD }} + + # - name: Push docker image + # run: | + # docker push litentry/litentry-parachain:$DOCKER_TAG + + # - name: Generate genesis artefacts if need + # if: github.event.inputs.genesis_release != 'none' + # run: | + # docker run --rm litentry/litentry-parachain:$DOCKER_TAG export-genesis-state --chain=${{ env.GENESIS_RELEASE }} > ${{ env.GENESIS_RELEASE }}-genesis-state + # docker run --rm litentry/litentry-parachain:$DOCKER_TAG export-genesis-wasm --chain=${{ env.GENESIS_RELEASE }} > ${{ env.GENESIS_RELEASE }}-genesis-wasm + + # - name: Copy client binary to disk + # run: | + # docker cp $(docker create --rm litentry/litentry-parachain:$DOCKER_TAG):/usr/local/bin/litentry-collator . + + # - name: Upload the client binary + # uses: actions/upload-artifact@v3 + # with: + # name: litentry-collator + # if-no-files-found: ignore + # path: | + # litentry-collator + # ${{ env.GENESIS_RELEASE }}-genesis-state + # ${{ env.GENESIS_RELEASE }}-genesis-wasm + + build-worker-docker: + if: ${{ github.event.inputs.release_client == 'true' }} + runs-on: ubuntu-latest + steps: + - name: Checkout codes on ${{ env.RELEASE_TAG }} + uses: actions/checkout@v4 + with: + ref: ${{ env.RELEASE_TAG }} + fetch-depth: 0 + - name: Build worker uses: docker/build-push-action@v5 with: @@ -157,37 +197,6 @@ jobs: target: deployed-client - run: docker images --all - - # - name: Dockerhub login - # uses: docker/login-action@v3 - # with: - # username: ${{ secrets.DOCKERHUB_USERNAME }} - # password: ${{ secrets.DOCKERHUB_PASSWORD }} - - # - name: Push docker image - # run: | - # docker push litentry/litentry-parachain:$DOCKER_TAG - - # - name: Generate genesis artefacts if need - # if: github.event.inputs.genesis_release != 'none' - # run: | - # docker run --rm litentry/litentry-parachain:$DOCKER_TAG export-genesis-state --chain=${{ env.GENESIS_RELEASE }} > ${{ env.GENESIS_RELEASE }}-genesis-state - # docker run --rm litentry/litentry-parachain:$DOCKER_TAG export-genesis-wasm --chain=${{ env.GENESIS_RELEASE }} > ${{ env.GENESIS_RELEASE }}-genesis-wasm - - # - name: Copy client binary to disk - # run: | - # docker cp $(docker create --rm litentry/litentry-parachain:$DOCKER_TAG):/usr/local/bin/litentry-collator . - - # - name: Upload the client binary - # uses: actions/upload-artifact@v3 - # with: - # name: litentry-collator - # if-no-files-found: ignore - # path: | - # litentry-collator - # ${{ env.GENESIS_RELEASE }}-genesis-state - # ${{ env.GENESIS_RELEASE }}-genesis-wasm - # ## Build the enclave and package config files # build-tee: # if: ${{ github.event.inputs.release_worker == 'true' }} || ${{ github.event.inputs.release_enclave == 'true' }} From 88e84b4de632666c820945e3aff304732a23f14f Mon Sep 17 00:00:00 2001 From: Verin1005 Date: Wed, 6 Dec 2023 17:28:00 +0800 Subject: [PATCH 03/40] add Docker Buildx --- .github/workflows/create-release-draft.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index 0ccbd4ef7a..648ba97ec7 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -179,7 +179,26 @@ jobs: with: ref: ${{ env.RELEASE_TAG }} fetch-depth: 0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + # use the docker driver to access the local image + # we don't need external caches or multi platforms here + # see https://docs.docker.com/build/drivers/ + driver: docker + - name: Build local builder + uses: docker/build-push-action@v5 + with: + context: . + file: tee-worker/build.Dockerfile + tags: local-builder:${{env.RELEASE_WORKER_TAG}} + target: builder + build-args: | + WORKER_MODE_ARG=sidechain + ADDITIONAL_FEATURES_ARG= + - name: Build worker uses: docker/build-push-action@v5 with: From a1373de1602891d19f6248f010ddba272ff7cff8 Mon Sep 17 00:00:00 2001 From: Verin1005 Date: Wed, 6 Dec 2023 17:40:11 +0800 Subject: [PATCH 04/40] add caches --- .github/workflows/create-release-draft.yml | 48 +++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index 648ba97ec7..b2c85d2697 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -48,6 +48,7 @@ env: DIFF_TAG: ${{ github.event.inputs.diff_tag }} GENESIS_RELEASE: ${{ github.event.inputs.genesis_release }} DOCKER_BUILDKIT: 1 + REF_VERSION: ${{ github.head_ref || github.ref_name }} jobs: set-release-type: @@ -187,7 +188,29 @@ jobs: # we don't need external caches or multi platforms here # see https://docs.docker.com/build/drivers/ driver: docker + + - name: Cache worker-cache + uses: actions/cache@v3 + with: + path: | + worker-cache + key: worker-cache-${{ env.REF_VERSION }}-${{ hashFiles('tee-worker/**/Cargo.lock', 'tee-worker/**/Cargo.toml') }} + restore-keys: | + worker-cache-${{ env.REF_VERSION }}- + worker-cache- + - name: Create cache folder if not exist + run: | + for i in 'git/db' 'registry/cache' 'registry/index' 'sccache'; do + [ ! -d "worker-cache/$i" ] && mkdir -p "worker-cache/$i" || true + echo "hello" > worker-cache/$i/nix + done + echo "::group::List worker-cache size" + du -sh worker-cache/* + echo "::endgroup::" + echo "::group::Show disk usage" + df -h . + echo "::endgroup::" - name: Build local builder uses: docker/build-push-action@v5 with: @@ -198,7 +221,30 @@ jobs: build-args: | WORKER_MODE_ARG=sidechain ADDITIONAL_FEATURES_ARG= - + + - name: Copy caches from the built image + run: | + echo "::group::Show disk usage" + df -h . + echo "::endgroup::" + echo "::group::docker images" + docker images --all + echo "::endgroup::" + echo "::group::copy cache out" + for i in 'git/db' 'registry/cache' 'registry/index'; do + b="${i%/*}" + rm -rf worker-cache/$i + docker cp "$(docker create --rm local-builder:${{env.RELEASE_WORKER_TAG}}):/opt/rust/$i" worker-cache/$b + done + rm -rf worker-cache/sccache + docker cp "$(docker create --rm local-builder:${{env.RELEASE_WORKER_TAG}}):/opt/rust/sccache" worker-cache + du -sh worker-cache/* + echo "::endgroup::" + echo "::group::df -h ." + df -h . + echo "::endgroup::" + + - name: Build worker uses: docker/build-push-action@v5 with: From bb277e0d7b59b941278b2731a0a52d3f0d9189e8 Mon Sep 17 00:00:00 2001 From: Verin1005 Date: Wed, 6 Dec 2023 17:50:47 +0800 Subject: [PATCH 05/40] free up disk space --- .github/workflows/create-release-draft.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index b2c85d2697..11c8b40f29 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -175,6 +175,14 @@ jobs: if: ${{ github.event.inputs.release_client == 'true' }} runs-on: ubuntu-latest steps: + - name: Free up disk space + if: startsWith(runner.name, 'GitHub Actions') + uses: jlumbroso/free-disk-space@main + with: + tool-cache: true + swap-storage: false + large-packages: false + - name: Checkout codes on ${{ env.RELEASE_TAG }} uses: actions/checkout@v4 with: From eba2b33f088e1d3f53c16ee1dfcb712522e1700e Mon Sep 17 00:00:00 2001 From: Verin1005 Date: Wed, 6 Dec 2023 18:08:05 +0800 Subject: [PATCH 06/40] remove caches --- .github/workflows/create-release-draft.yml | 58 +--------------------- 1 file changed, 1 insertion(+), 57 deletions(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index 11c8b40f29..b0c62e48fd 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -182,7 +182,7 @@ jobs: tool-cache: true swap-storage: false large-packages: false - + - name: Checkout codes on ${{ env.RELEASE_TAG }} uses: actions/checkout@v4 with: @@ -197,62 +197,6 @@ jobs: # see https://docs.docker.com/build/drivers/ driver: docker - - name: Cache worker-cache - uses: actions/cache@v3 - with: - path: | - worker-cache - key: worker-cache-${{ env.REF_VERSION }}-${{ hashFiles('tee-worker/**/Cargo.lock', 'tee-worker/**/Cargo.toml') }} - restore-keys: | - worker-cache-${{ env.REF_VERSION }}- - worker-cache- - - - name: Create cache folder if not exist - run: | - for i in 'git/db' 'registry/cache' 'registry/index' 'sccache'; do - [ ! -d "worker-cache/$i" ] && mkdir -p "worker-cache/$i" || true - echo "hello" > worker-cache/$i/nix - done - echo "::group::List worker-cache size" - du -sh worker-cache/* - echo "::endgroup::" - echo "::group::Show disk usage" - df -h . - echo "::endgroup::" - - name: Build local builder - uses: docker/build-push-action@v5 - with: - context: . - file: tee-worker/build.Dockerfile - tags: local-builder:${{env.RELEASE_WORKER_TAG}} - target: builder - build-args: | - WORKER_MODE_ARG=sidechain - ADDITIONAL_FEATURES_ARG= - - - name: Copy caches from the built image - run: | - echo "::group::Show disk usage" - df -h . - echo "::endgroup::" - echo "::group::docker images" - docker images --all - echo "::endgroup::" - echo "::group::copy cache out" - for i in 'git/db' 'registry/cache' 'registry/index'; do - b="${i%/*}" - rm -rf worker-cache/$i - docker cp "$(docker create --rm local-builder:${{env.RELEASE_WORKER_TAG}}):/opt/rust/$i" worker-cache/$b - done - rm -rf worker-cache/sccache - docker cp "$(docker create --rm local-builder:${{env.RELEASE_WORKER_TAG}}):/opt/rust/sccache" worker-cache - du -sh worker-cache/* - echo "::endgroup::" - echo "::group::df -h ." - df -h . - echo "::endgroup::" - - - name: Build worker uses: docker/build-push-action@v5 with: From cf322679e4c3068209e77552f2bb1865c12769f6 Mon Sep 17 00:00:00 2001 From: Verin1005 Date: Wed, 6 Dec 2023 18:32:13 +0800 Subject: [PATCH 07/40] build local builder --- .github/workflows/create-release-draft.yml | 57 +++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index b0c62e48fd..a9ab92092c 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -182,7 +182,7 @@ jobs: tool-cache: true swap-storage: false large-packages: false - + - name: Checkout codes on ${{ env.RELEASE_TAG }} uses: actions/checkout@v4 with: @@ -197,6 +197,61 @@ jobs: # see https://docs.docker.com/build/drivers/ driver: docker + # - name: Cache worker-cache + # uses: actions/cache@v3 + # with: + # path: | + # worker-cache + # key: worker-cache-${{ env.REF_VERSION }}-${{ hashFiles('tee-worker/**/Cargo.lock', 'tee-worker/**/Cargo.toml') }} + # restore-keys: | + # worker-cache-${{ env.REF_VERSION }}- + # worker-cache- + + # - name: Create cache folder if not exist + # run: | + # for i in 'git/db' 'registry/cache' 'registry/index' 'sccache'; do + # [ ! -d "worker-cache/$i" ] && mkdir -p "worker-cache/$i" || true + # echo "hello" > worker-cache/$i/nix + # done + # echo "::group::List worker-cache size" + # du -sh worker-cache/* + # echo "::endgroup::" + # echo "::group::Show disk usage" + # df -h . + # echo "::endgroup::" + - name: Build local builder + uses: docker/build-push-action@v5 + with: + context: . + file: tee-worker/build.Dockerfile + tags: local-builder:latest + target: builder + build-args: | + WORKER_MODE_ARG=sidechain + ADDITIONAL_FEATURES_ARG= + + # - name: Copy caches from the built image + # run: | + # echo "::group::Show disk usage" + # df -h . + # echo "::endgroup::" + # echo "::group::docker images" + # docker images --all + # echo "::endgroup::" + # echo "::group::copy cache out" + # for i in 'git/db' 'registry/cache' 'registry/index'; do + # b="${i%/*}" + # rm -rf worker-cache/$i + # docker cp "$(docker create --rm local-builder:latest):/opt/rust/$i" worker-cache/$b + # done + # rm -rf worker-cache/sccache + # docker cp "$(docker create --rm local-builder:latest):/opt/rust/sccache" worker-cache + # du -sh worker-cache/* + # echo "::endgroup::" + # echo "::group::df -h ." + # df -h . + # echo "::endgroup::" + - name: Build worker uses: docker/build-push-action@v5 with: From c5be054d24d22085d471a44806434a1b69ded6e4 Mon Sep 17 00:00:00 2001 From: Verin1005 Date: Wed, 6 Dec 2023 20:16:32 +0800 Subject: [PATCH 08/40] re-base worker-cache --- .github/workflows/create-release-draft.yml | 85 +++++++++++----------- 1 file changed, 43 insertions(+), 42 deletions(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index a9ab92092c..d3df8dae64 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -197,28 +197,29 @@ jobs: # see https://docs.docker.com/build/drivers/ driver: docker - # - name: Cache worker-cache - # uses: actions/cache@v3 - # with: - # path: | - # worker-cache - # key: worker-cache-${{ env.REF_VERSION }}-${{ hashFiles('tee-worker/**/Cargo.lock', 'tee-worker/**/Cargo.toml') }} - # restore-keys: | - # worker-cache-${{ env.REF_VERSION }}- - # worker-cache- + - name: Cache worker-cache + uses: actions/cache@v3 + with: + path: | + worker-cache + key: worker-cache-${{ env.REF_VERSION }}-${{ hashFiles('tee-worker/**/Cargo.lock', 'tee-worker/**/Cargo.toml') }} + restore-keys: | + worker-cache-${{ env.REF_VERSION }}- + worker-cache- + + - name: Create cache folder if not exist + run: | + for i in 'git/db' 'registry/cache' 'registry/index' 'sccache'; do + [ ! -d "worker-cache/$i" ] && mkdir -p "worker-cache/$i" || true + echo "hello" > worker-cache/$i/nix + done + echo "::group::List worker-cache size" + du -sh worker-cache/* + echo "::endgroup::" + echo "::group::Show disk usage" + df -h . + echo "::endgroup::" - # - name: Create cache folder if not exist - # run: | - # for i in 'git/db' 'registry/cache' 'registry/index' 'sccache'; do - # [ ! -d "worker-cache/$i" ] && mkdir -p "worker-cache/$i" || true - # echo "hello" > worker-cache/$i/nix - # done - # echo "::group::List worker-cache size" - # du -sh worker-cache/* - # echo "::endgroup::" - # echo "::group::Show disk usage" - # df -h . - # echo "::endgroup::" - name: Build local builder uses: docker/build-push-action@v5 with: @@ -230,27 +231,27 @@ jobs: WORKER_MODE_ARG=sidechain ADDITIONAL_FEATURES_ARG= - # - name: Copy caches from the built image - # run: | - # echo "::group::Show disk usage" - # df -h . - # echo "::endgroup::" - # echo "::group::docker images" - # docker images --all - # echo "::endgroup::" - # echo "::group::copy cache out" - # for i in 'git/db' 'registry/cache' 'registry/index'; do - # b="${i%/*}" - # rm -rf worker-cache/$i - # docker cp "$(docker create --rm local-builder:latest):/opt/rust/$i" worker-cache/$b - # done - # rm -rf worker-cache/sccache - # docker cp "$(docker create --rm local-builder:latest):/opt/rust/sccache" worker-cache - # du -sh worker-cache/* - # echo "::endgroup::" - # echo "::group::df -h ." - # df -h . - # echo "::endgroup::" + - name: Copy caches from the built image + run: | + echo "::group::Show disk usage" + df -h . + echo "::endgroup::" + echo "::group::docker images" + docker images --all + echo "::endgroup::" + echo "::group::copy cache out" + for i in 'git/db' 'registry/cache' 'registry/index'; do + b="${i%/*}" + rm -rf worker-cache/$i + docker cp "$(docker create --rm local-builder:latest):/opt/rust/$i" worker-cache/$b + done + rm -rf worker-cache/sccache + docker cp "$(docker create --rm local-builder:latest):/opt/rust/sccache" worker-cache + du -sh worker-cache/* + echo "::endgroup::" + echo "::group::df -h ." + df -h . + echo "::endgroup::" - name: Build worker uses: docker/build-push-action@v5 From cb33d1931b5bdc418da934ad199774670139de83 Mon Sep 17 00:00:00 2001 From: Verin1005 Date: Wed, 6 Dec 2023 22:03:15 +0800 Subject: [PATCH 09/40] push docker image --- .github/workflows/create-release-draft.yml | 116 ++++++++++++--------- 1 file changed, 64 insertions(+), 52 deletions(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index d3df8dae64..be5f8065f0 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -27,7 +27,7 @@ on: description: an existing tag for creating release (e.g. v1.2.3) required: true release_worker_tag: - description: an existing tag for creating release (e.g. v1.2.3) + description: an existing tag for creating worker release (e.g. v1.2.3) required: true diff_tag: description: an existing tag to run diff against (e.g. v1.2.0) @@ -119,57 +119,57 @@ jobs: ${{ matrix.chain }}-parachain-srtool-digest.json ${{ matrix.chain }}-parachain-runtime.compact.compressed.wasm - ## build docker image of parachain binary ## - build-docker: - if: ${{ github.event.inputs.release_client == 'true' }} - runs-on: ubuntu-latest - steps: - - name: Checkout codes on ${{ env.RELEASE_TAG }} - uses: actions/checkout@v4 - with: - ref: ${{ env.RELEASE_TAG }} - fetch-depth: 0 + # # build docker image of parachain binary ## + # build-parachain-docker: + # if: ${{ github.event.inputs.release_client == 'true' }} + # runs-on: ubuntu-latest + # steps: + # - name: Checkout codes on ${{ env.RELEASE_TAG }} + # uses: actions/checkout@v4 + # with: + # ref: ${{ env.RELEASE_TAG }} + # fetch-depth: 0 - - name: Set env - run: | - DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') - echo "DOCKER_TAG=$DOCKER_TAG" >> $GITHUB_ENV + # - name: Set env + # run: | + # DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') + # echo "DOCKER_TAG=$DOCKER_TAG" >> $GITHUB_ENV - - name: Build docker image - run: | - ./scripts/build-docker.sh production $DOCKER_TAG - echo "=============================" - docker images - - # - name: Dockerhub login - # uses: docker/login-action@v3 - # with: - # username: ${{ secrets.DOCKERHUB_USERNAME }} - # password: ${{ secrets.DOCKERHUB_PASSWORD }} - - # - name: Push docker image - # run: | - # docker push litentry/litentry-parachain:$DOCKER_TAG - - # - name: Generate genesis artefacts if need - # if: github.event.inputs.genesis_release != 'none' - # run: | - # docker run --rm litentry/litentry-parachain:$DOCKER_TAG export-genesis-state --chain=${{ env.GENESIS_RELEASE }} > ${{ env.GENESIS_RELEASE }}-genesis-state - # docker run --rm litentry/litentry-parachain:$DOCKER_TAG export-genesis-wasm --chain=${{ env.GENESIS_RELEASE }} > ${{ env.GENESIS_RELEASE }}-genesis-wasm - - # - name: Copy client binary to disk - # run: | - # docker cp $(docker create --rm litentry/litentry-parachain:$DOCKER_TAG):/usr/local/bin/litentry-collator . - - # - name: Upload the client binary - # uses: actions/upload-artifact@v3 - # with: - # name: litentry-collator - # if-no-files-found: ignore - # path: | - # litentry-collator - # ${{ env.GENESIS_RELEASE }}-genesis-state - # ${{ env.GENESIS_RELEASE }}-genesis-wasm + # - name: Build docker image + # run: | + # ./scripts/build-docker.sh production $DOCKER_TAG + # echo "=============================" + # docker images + + # - name: Dockerhub login + # uses: docker/login-action@v3 + # with: + # username: ${{ secrets.DOCKERHUB_USERNAME }} + # password: ${{ secrets.DOCKERHUB_PASSWORD }} + + # - name: Push docker image + # run: | + # docker push litentry/litentry-parachain:$DOCKER_TAG + + # - name: Generate genesis artefacts if need + # if: github.event.inputs.genesis_release != 'none' + # run: | + # docker run --rm litentry/litentry-parachain:$DOCKER_TAG export-genesis-state --chain=${{ env.GENESIS_RELEASE }} > ${{ env.GENESIS_RELEASE }}-genesis-state + # docker run --rm litentry/litentry-parachain:$DOCKER_TAG export-genesis-wasm --chain=${{ env.GENESIS_RELEASE }} > ${{ env.GENESIS_RELEASE }}-genesis-wasm + + # - name: Copy client binary to disk + # run: | + # docker cp $(docker create --rm litentry/litentry-parachain:$DOCKER_TAG):/usr/local/bin/litentry-collator . + + # - name: Upload the client binary + # uses: actions/upload-artifact@v3 + # with: + # name: litentry-collator + # if-no-files-found: ignore + # path: | + # litentry-collator + # ${{ env.GENESIS_RELEASE }}-genesis-state + # ${{ env.GENESIS_RELEASE }}-genesis-wasm build-worker-docker: if: ${{ github.event.inputs.release_client == 'true' }} @@ -270,6 +270,18 @@ jobs: target: deployed-client - run: docker images --all + + - name: Dockerhub login + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + + - name: Push worker image + run: | + docker push litentry/litentry-worker:${{env.RELEASE_WORKER_TAG}} + docker push litentry/litentry-cli:${{env.RELEASE_WORKER_TAG}} + # ## Build the enclave and package config files # build-tee: # if: ${{ github.event.inputs.release_worker == 'true' }} || ${{ github.event.inputs.release_enclave == 'true' }} @@ -322,7 +334,7 @@ jobs: # ## test again the built docker image ## # run-ts-tests: # runs-on: ubuntu-latest - # needs: build-docker + # needs: build-parachain-docker # strategy: # matrix: # chain: @@ -364,7 +376,7 @@ jobs: # ## check extrinsic ## # extrinsic-ordering-check-from-bin: # runs-on: ubuntu-latest - # needs: build-docker + # needs: build-parachain-docker # strategy: # matrix: # chain: [rococo, litmus, litentry] From 636efd86f6d9e5667e053533f1e0c3fba933e569 Mon Sep 17 00:00:00 2001 From: Verin1005 Date: Wed, 6 Dec 2023 22:35:47 +0800 Subject: [PATCH 10/40] change condition --- .github/workflows/create-release-draft.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index be5f8065f0..e5c2ff03ac 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -172,7 +172,7 @@ jobs: # ${{ env.GENESIS_RELEASE }}-genesis-wasm build-worker-docker: - if: ${{ github.event.inputs.release_client == 'true' }} + if: ${{ github.event.inputs.release_worker == 'true' }} runs-on: ubuntu-latest steps: - name: Free up disk space From a82bc50c1df9950e4212fde787de7fd164a5c906 Mon Sep 17 00:00:00 2001 From: Verin1005 Date: Wed, 6 Dec 2023 23:11:44 +0800 Subject: [PATCH 11/40] uncomment --- .github/workflows/create-release-draft.yml | 504 ++++++++++----------- 1 file changed, 252 insertions(+), 252 deletions(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index e5c2ff03ac..68d7d55909 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -119,57 +119,57 @@ jobs: ${{ matrix.chain }}-parachain-srtool-digest.json ${{ matrix.chain }}-parachain-runtime.compact.compressed.wasm - # # build docker image of parachain binary ## - # build-parachain-docker: - # if: ${{ github.event.inputs.release_client == 'true' }} - # runs-on: ubuntu-latest - # steps: - # - name: Checkout codes on ${{ env.RELEASE_TAG }} - # uses: actions/checkout@v4 - # with: - # ref: ${{ env.RELEASE_TAG }} - # fetch-depth: 0 - - # - name: Set env - # run: | - # DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') - # echo "DOCKER_TAG=$DOCKER_TAG" >> $GITHUB_ENV - - # - name: Build docker image - # run: | - # ./scripts/build-docker.sh production $DOCKER_TAG - # echo "=============================" - # docker images - - # - name: Dockerhub login - # uses: docker/login-action@v3 - # with: - # username: ${{ secrets.DOCKERHUB_USERNAME }} - # password: ${{ secrets.DOCKERHUB_PASSWORD }} - - # - name: Push docker image - # run: | - # docker push litentry/litentry-parachain:$DOCKER_TAG - - # - name: Generate genesis artefacts if need - # if: github.event.inputs.genesis_release != 'none' - # run: | - # docker run --rm litentry/litentry-parachain:$DOCKER_TAG export-genesis-state --chain=${{ env.GENESIS_RELEASE }} > ${{ env.GENESIS_RELEASE }}-genesis-state - # docker run --rm litentry/litentry-parachain:$DOCKER_TAG export-genesis-wasm --chain=${{ env.GENESIS_RELEASE }} > ${{ env.GENESIS_RELEASE }}-genesis-wasm - - # - name: Copy client binary to disk - # run: | - # docker cp $(docker create --rm litentry/litentry-parachain:$DOCKER_TAG):/usr/local/bin/litentry-collator . - - # - name: Upload the client binary - # uses: actions/upload-artifact@v3 - # with: - # name: litentry-collator - # if-no-files-found: ignore - # path: | - # litentry-collator - # ${{ env.GENESIS_RELEASE }}-genesis-state - # ${{ env.GENESIS_RELEASE }}-genesis-wasm + # build docker image of parachain binary ## + build-parachain-docker: + if: ${{ github.event.inputs.release_client == 'true' }} + runs-on: ubuntu-latest + steps: + - name: Checkout codes on ${{ env.RELEASE_TAG }} + uses: actions/checkout@v4 + with: + ref: ${{ env.RELEASE_TAG }} + fetch-depth: 0 + + - name: Set env + run: | + DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') + echo "DOCKER_TAG=$DOCKER_TAG" >> $GITHUB_ENV + + - name: Build docker image + run: | + ./scripts/build-docker.sh production $DOCKER_TAG + echo "=============================" + docker images + + - name: Dockerhub login + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + + - name: Push docker image + run: | + docker push litentry/litentry-parachain:$DOCKER_TAG + + - name: Generate genesis artefacts if need + if: github.event.inputs.genesis_release != 'none' + run: | + docker run --rm litentry/litentry-parachain:$DOCKER_TAG export-genesis-state --chain=${{ env.GENESIS_RELEASE }} > ${{ env.GENESIS_RELEASE }}-genesis-state + docker run --rm litentry/litentry-parachain:$DOCKER_TAG export-genesis-wasm --chain=${{ env.GENESIS_RELEASE }} > ${{ env.GENESIS_RELEASE }}-genesis-wasm + + - name: Copy client binary to disk + run: | + docker cp $(docker create --rm litentry/litentry-parachain:$DOCKER_TAG):/usr/local/bin/litentry-collator . + + - name: Upload the client binary + uses: actions/upload-artifact@v3 + with: + name: litentry-collator + if-no-files-found: ignore + path: | + litentry-collator + ${{ env.GENESIS_RELEASE }}-genesis-state + ${{ env.GENESIS_RELEASE }}-genesis-wasm build-worker-docker: if: ${{ github.event.inputs.release_worker == 'true' }} @@ -282,207 +282,207 @@ jobs: docker push litentry/litentry-worker:${{env.RELEASE_WORKER_TAG}} docker push litentry/litentry-cli:${{env.RELEASE_WORKER_TAG}} - # ## Build the enclave and package config files - # build-tee: - # if: ${{ github.event.inputs.release_worker == 'true' }} || ${{ github.event.inputs.release_enclave == 'true' }} - # runs-on: tee-prod-builder - # outputs: - # mrenclave: ${{ steps.mrenclave.outputs.mrenclave }} - # enclave_sha1sum: ${{ steps.shasum.outputs.enclave_sha1sum }} - # worker_sha1sum: ${{ steps.shasum.outputs.worker_sha1sum }} - # steps: - # - name: Checkout codes on ${{ env.RELEASE_TAG }} - # uses: actions/checkout@v4 - # with: - # ref: ${{ env.RELEASE_TAG }} - # fetch-depth: 0 - - # - name: Build release artefacts - # run: | - # source /opt/intel/sgxsdk/environment - # ./tee-worker/scripts/litentry/release/build.sh ${{ github.event.inputs.release_worker }} ${{ github.event.inputs.release_enclave }} - - # - name: Set MRENCLAVE - # id: mrenclave - # run: | - # MRENCLAVE= - # f="tee-worker/enclave_release/mrenclave.txt" - # [ -f "$f" ] && MRENCLAVE=$(cat "$f") - # echo "mrenclave=$MRENCLAVE" >> $GITHUB_OUTPUT - - # - name: Set shasum - # id: shasum - # run: | - # ENCLAVE_SHA1SUM= - # WORKER_SHA1SUM= - # cd tee-worker/enclave_release - # [ -f "enclave.signed.so" ] && ENCLAVE_SHA1SUM=$(shasum enclave.signed.so | awk '{print $1}') - # [ -f "litentry-worker" ] && WORKER_SHA1SUM=$(shasum litentry-worker | awk '{print $1}') - # echo "enclave_sha1sum=$ENCLAVE_SHA1SUM" >> $GITHUB_OUTPUT - # echo "worker_sha1sum=$WORKER_SHA1SUM" >> $GITHUB_OUTPUT - - # - name: Upload artefacts - # uses: actions/upload-artifact@v3 - # with: - # name: litentry-tee - # path: ./tee-worker/enclave_release/* - - # - name: Fail early - # if: failure() - # uses: andymckay/cancel-action@0.3 + ## Build the enclave and package config files + build-tee: + if: ${{ github.event.inputs.release_worker == 'true' }} || ${{ github.event.inputs.release_enclave == 'true' }} + runs-on: tee-prod-builder + outputs: + mrenclave: ${{ steps.mrenclave.outputs.mrenclave }} + enclave_sha1sum: ${{ steps.shasum.outputs.enclave_sha1sum }} + worker_sha1sum: ${{ steps.shasum.outputs.worker_sha1sum }} + steps: + - name: Checkout codes on ${{ env.RELEASE_TAG }} + uses: actions/checkout@v4 + with: + ref: ${{ env.RELEASE_TAG }} + fetch-depth: 0 + + - name: Build release artefacts + run: | + source /opt/intel/sgxsdk/environment + ./tee-worker/scripts/litentry/release/build.sh ${{ github.event.inputs.release_worker }} ${{ github.event.inputs.release_enclave }} + + - name: Set MRENCLAVE + id: mrenclave + run: | + MRENCLAVE= + f="tee-worker/enclave_release/mrenclave.txt" + [ -f "$f" ] && MRENCLAVE=$(cat "$f") + echo "mrenclave=$MRENCLAVE" >> $GITHUB_OUTPUT + + - name: Set shasum + id: shasum + run: | + ENCLAVE_SHA1SUM= + WORKER_SHA1SUM= + cd tee-worker/enclave_release + [ -f "enclave.signed.so" ] && ENCLAVE_SHA1SUM=$(shasum enclave.signed.so | awk '{print $1}') + [ -f "litentry-worker" ] && WORKER_SHA1SUM=$(shasum litentry-worker | awk '{print $1}') + echo "enclave_sha1sum=$ENCLAVE_SHA1SUM" >> $GITHUB_OUTPUT + echo "worker_sha1sum=$WORKER_SHA1SUM" >> $GITHUB_OUTPUT + + - name: Upload artefacts + uses: actions/upload-artifact@v3 + with: + name: litentry-tee + path: ./tee-worker/enclave_release/* + + - name: Fail early + if: failure() + uses: andymckay/cancel-action@0.3 - # ## test again the built docker image ## - # run-ts-tests: - # runs-on: ubuntu-latest - # needs: build-parachain-docker - # strategy: - # matrix: - # chain: - # - litmus - # - litentry - # steps: - # - name: Checkout codes - # uses: actions/checkout@v4 - # with: - # fetch-depth: 0 - - # - name: Enable corepack and pnpm - # run: corepack enable && corepack enable pnpm - - # - name: Download and tag docker image - # run: | - # export DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') - # docker pull litentry/litentry-parachain:$DOCKER_TAG - # docker tag litentry/litentry-parachain:$DOCKER_TAG litentry/litentry-parachain:latest - - # - name: Run ts tests for ${{ matrix.chain }} - # timeout-minutes: 20 - # run: | - # make test-ts-docker-${{ matrix.chain }} - - # - name: Archive logs if test fails - # uses: actions/upload-artifact@v3 - # if: ${{ failure() }} - # with: - # name: ${{ matrix.chain }}-ts-tests-artifacts - # path: /tmp/parachain_dev/ - # retention-days: 3 - - # - name: Clean up for ${{ matrix.chain }} - # if: ${{ always() }} - # run: | - # make clean-docker-${{ matrix.chain }} - - # ## check extrinsic ## - # extrinsic-ordering-check-from-bin: - # runs-on: ubuntu-latest - # needs: build-parachain-docker - # strategy: - # matrix: - # chain: [rococo, litmus, litentry] - # include: - # - chain: rococo - # ref_url: wss://rpc.rococo-parachain-sg.litentry.io - # - chain: litmus - # ref_url: wss://rpc.litmus-parachain.litentry.io - # - chain: litentry - # ref_url: wss://rpc.litentry-parachain.litentry.io - # steps: - # - name: Checkout sources - # uses: actions/checkout@v4 - # with: - # ref: ${{ env.RELEASE_TAG }} - - # - name: Prepare output and compare the metadata - # timeout-minutes: 3 - # run: | - # export DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') - # PARACHAIN_NAME=local-parachain - # BASE_URL=ws://127.0.0.1:9944 - # chain=${{ matrix.chain }} - # REF_URL=${{ matrix.ref_url }} - # echo "Metadata comparison:" > output-$chain.txt - # echo "Date: $(date)" >> output-$chain.txt - # echo "Base: $BASE_URL" >> output-$chain.txt - # echo "Reference: $REF_URL" >> output-$chain.txt - # echo "Target Tag: ${{ env.RELEASE_TAG }}" >> output-$chain.txt - # echo "Chain: $chain" >> output-$chain.txt - # echo "----------------------------------------------------------------------" >> output-$chain.txt - # echo "Running parachain: $chain" - # docker run --pull always --rm --name=$PARACHAIN_NAME -d -p 9944:9944 litentry/litentry-parachain:$DOCKER_TAG --chain=$chain-dev --rpc-cors=all --ws-external --tmp -- --dev - # sleep 3 - # CMD="docker run --pull always --network host jacogr/polkadot-js-tools metadata $REF_URL $BASE_URL" - # echo -e "Running:\n$CMD" - # docker run --pull always --rm --network host jacogr/polkadot-js-tools metadata $REF_URL $BASE_URL | tee -a output-$chain.txt - # SUMMARY=$(./scripts/extrinsic-ordering-filter.sh output-$chain.txt) - # echo -e $SUMMARY >> output-$chain.txt - # docker stop $PARACHAIN_NAME - # content=$(< output-$chain.txt) - # echo "content<> $GITHUB_ENV - # echo "$content" >> $GITHUB_ENV - # echo "EOF" >> $GITHUB_ENV - - # - name: Find issues - # uses: actions-cool/issues-helper@v3 - # id: findissueid - # with: - # actions: 'find-issues' - # token: ${{ secrets.GITHUB_TOKEN }} - # issue-state: 'open' - # title-includes: Litentry-parachain ${{ env.RELEASE_TAG }} Release checklist + ## test again the built docker image ## + run-ts-tests: + runs-on: ubuntu-latest + needs: build-parachain-docker + strategy: + matrix: + chain: + - litmus + - litentry + steps: + - name: Checkout codes + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Enable corepack and pnpm + run: corepack enable && corepack enable pnpm + + - name: Download and tag docker image + run: | + export DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') + docker pull litentry/litentry-parachain:$DOCKER_TAG + docker tag litentry/litentry-parachain:$DOCKER_TAG litentry/litentry-parachain:latest + + - name: Run ts tests for ${{ matrix.chain }} + timeout-minutes: 20 + run: | + make test-ts-docker-${{ matrix.chain }} + + - name: Archive logs if test fails + uses: actions/upload-artifact@v3 + if: ${{ failure() }} + with: + name: ${{ matrix.chain }}-ts-tests-artifacts + path: /tmp/parachain_dev/ + retention-days: 3 + + - name: Clean up for ${{ matrix.chain }} + if: ${{ always() }} + run: | + make clean-docker-${{ matrix.chain }} + + ## check extrinsic ## + extrinsic-ordering-check-from-bin: + runs-on: ubuntu-latest + needs: build-parachain-docker + strategy: + matrix: + chain: [rococo, litmus, litentry] + include: + - chain: rococo + ref_url: wss://rpc.rococo-parachain-sg.litentry.io + - chain: litmus + ref_url: wss://rpc.litmus-parachain.litentry.io + - chain: litentry + ref_url: wss://rpc.litentry-parachain.litentry.io + steps: + - name: Checkout sources + uses: actions/checkout@v4 + with: + ref: ${{ env.RELEASE_TAG }} + + - name: Prepare output and compare the metadata + timeout-minutes: 3 + run: | + export DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') + PARACHAIN_NAME=local-parachain + BASE_URL=ws://127.0.0.1:9944 + chain=${{ matrix.chain }} + REF_URL=${{ matrix.ref_url }} + echo "Metadata comparison:" > output-$chain.txt + echo "Date: $(date)" >> output-$chain.txt + echo "Base: $BASE_URL" >> output-$chain.txt + echo "Reference: $REF_URL" >> output-$chain.txt + echo "Target Tag: ${{ env.RELEASE_TAG }}" >> output-$chain.txt + echo "Chain: $chain" >> output-$chain.txt + echo "----------------------------------------------------------------------" >> output-$chain.txt + echo "Running parachain: $chain" + docker run --pull always --rm --name=$PARACHAIN_NAME -d -p 9944:9944 litentry/litentry-parachain:$DOCKER_TAG --chain=$chain-dev --rpc-cors=all --ws-external --tmp -- --dev + sleep 3 + CMD="docker run --pull always --network host jacogr/polkadot-js-tools metadata $REF_URL $BASE_URL" + echo -e "Running:\n$CMD" + docker run --pull always --rm --network host jacogr/polkadot-js-tools metadata $REF_URL $BASE_URL | tee -a output-$chain.txt + SUMMARY=$(./scripts/extrinsic-ordering-filter.sh output-$chain.txt) + echo -e $SUMMARY >> output-$chain.txt + docker stop $PARACHAIN_NAME + content=$(< output-$chain.txt) + echo "content<> $GITHUB_ENV + echo "$content" >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + + - name: Find issues + uses: actions-cool/issues-helper@v3 + id: findissueid + with: + actions: 'find-issues' + token: ${{ secrets.GITHUB_TOKEN }} + issue-state: 'open' + title-includes: Litentry-parachain ${{ env.RELEASE_TAG }} Release checklist - # - name: Create comment - # if: ${{ steps.findissueid.outputs.issues }} != '[]' - # uses: actions-cool/issues-helper@v3 - # with: - # actions: 'create-comment' - # token: ${{ secrets.GITHUB_TOKEN }} - # issue-number: ${{ fromJson(steps.findissueid.outputs.issues)[0].number }} - # body: | - # ${{ env.content }} - - # ## create the release draft ## - # create-release-draft: - # runs-on: ubuntu-latest - # # see https://github.com/actions/runner/issues/491 - # # seems to be the only way to achieve this - # needs: - # - set-release-type - # - build-tee - # - run-ts-tests - # - build-wasm - # if: | - # !failure() && - # (success('build-wasm') || success('run-ts-tests') || success('build-tee')) - # steps: - # - name: Checkout codes on ${{ env.RELEASE_TAG }} - # uses: actions/checkout@v4 - # with: - # ref: ${{ env.RELEASE_TAG }} - # fetch-depth: 0 - - # - name: Download all artefacts - # uses: actions/download-artifact@v3 + - name: Create comment + if: ${{ steps.findissueid.outputs.issues }} != '[]' + uses: actions-cool/issues-helper@v3 + with: + actions: 'create-comment' + token: ${{ secrets.GITHUB_TOKEN }} + issue-number: ${{ fromJson(steps.findissueid.outputs.issues)[0].number }} + body: | + ${{ env.content }} + + ## create the release draft ## + create-release-draft: + runs-on: ubuntu-latest + # see https://github.com/actions/runner/issues/491 + # seems to be the only way to achieve this + needs: + - set-release-type + - build-tee + - run-ts-tests + - build-wasm + if: | + !failure() && + (success('build-wasm') || success('run-ts-tests') || success('build-tee')) + steps: + - name: Checkout codes on ${{ env.RELEASE_TAG }} + uses: actions/checkout@v4 + with: + ref: ${{ env.RELEASE_TAG }} + fetch-depth: 0 + + - name: Download all artefacts + uses: actions/download-artifact@v3 - # - name: Generate release notes - # run: | - # export MRENCLAVE="${{ needs.build-tee.outputs.mrenclave }}" - # export ENCLAVE_SHA1SUM="${{ needs.build-tee.outputs.enclave_sha1sum }}" - # export WORKER_SHA1SUM="${{ needs.build-tee.outputs.worker_sha1sum }}" - # ./scripts/generate-release-notes.sh ${{ github.workspace }}/.github/release_notes.md ${{ needs.set-release-type.outputs.release_type }} ${{ env.DIFF_TAG }} - # env: - # GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - # - name: Create release draft - # id: create-release-draft - # uses: softprops/action-gh-release@v1 - # with: - # tag_name: ${{ env.RELEASE_TAG }} - # name: Litentry-parachain ${{ env.RELEASE_TAG }} - # body_path: ${{ github.workspace }}/.github/release_notes.md - # draft: true - # files: | - # *-parachain-runtime/*-parachain-srtool-digest.json - # *-parachain-runtime/*-parachain-runtime.compact.compressed.wasm - # litentry-collator/* - # litentry-tee/* + - name: Generate release notes + run: | + export MRENCLAVE="${{ needs.build-tee.outputs.mrenclave }}" + export ENCLAVE_SHA1SUM="${{ needs.build-tee.outputs.enclave_sha1sum }}" + export WORKER_SHA1SUM="${{ needs.build-tee.outputs.worker_sha1sum }}" + ./scripts/generate-release-notes.sh ${{ github.workspace }}/.github/release_notes.md ${{ needs.set-release-type.outputs.release_type }} ${{ env.DIFF_TAG }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create release draft + id: create-release-draft + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ env.RELEASE_TAG }} + name: Litentry-parachain ${{ env.RELEASE_TAG }} + body_path: ${{ github.workspace }}/.github/release_notes.md + draft: true + files: | + *-parachain-runtime/*-parachain-srtool-digest.json + *-parachain-runtime/*-parachain-runtime.compact.compressed.wasm + litentry-collator/* + litentry-tee/* From 9080e641055a0ce74423d4863f2a3ad271a65671 Mon Sep 17 00:00:00 2001 From: Verin1005 Date: Mon, 11 Dec 2023 19:21:51 +0800 Subject: [PATCH 12/40] improve worker tag --- .github/workflows/create-release-draft.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index 68d7d55909..70e7e0278f 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -26,9 +26,6 @@ on: release_tag: description: an existing tag for creating release (e.g. v1.2.3) required: true - release_worker_tag: - description: an existing tag for creating worker release (e.g. v1.2.3) - required: true diff_tag: description: an existing tag to run diff against (e.g. v1.2.0) default: "" @@ -44,7 +41,6 @@ on: env: RELEASE_TAG: ${{ github.event.inputs.release_tag }} - RELEASE_WORKER_TAG: ${{ github.event.inputs.release_worker_tag }} DIFF_TAG: ${{ github.event.inputs.diff_tag }} GENESIS_RELEASE: ${{ github.event.inputs.genesis_release }} DOCKER_BUILDKIT: 1 @@ -188,6 +184,10 @@ jobs: with: ref: ${{ env.RELEASE_TAG }} fetch-depth: 0 + - name: Set worker tag + run: | + WORKER_TAG=$(echo "p0.10.17-9170-w0.0.1-100" | cut -d'-' -f4- | sed 's/w/v/') + echo "WORKER_TAG=$WORKER_TAG" >> $GITHUB_ENV - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -258,7 +258,7 @@ jobs: with: context: . file: tee-worker/build.Dockerfile - tags: litentry/litentry-worker:${{env.RELEASE_WORKER_TAG}} + tags: litentry/litentry-worker:$WORKER_TAG target: deployed-worker - name: Build cli @@ -266,7 +266,7 @@ jobs: with: context: . file: tee-worker/build.Dockerfile - tags: litentry/litentry-cli:${{env.RELEASE_WORKER_TAG}} + tags: litentry/litentry-cli:$WORKER_TAG target: deployed-client - run: docker images --all @@ -279,8 +279,8 @@ jobs: - name: Push worker image run: | - docker push litentry/litentry-worker:${{env.RELEASE_WORKER_TAG}} - docker push litentry/litentry-cli:${{env.RELEASE_WORKER_TAG}} + docker push litentry/litentry-worker:$WORKER_TAG + docker push litentry/litentry-cli:$WORKER_TAG ## Build the enclave and package config files build-tee: From 8ec2d885a9c93d8bbef0fa7ef29fbbf5dca26e8d Mon Sep 17 00:00:00 2001 From: Verin1005 Date: Mon, 11 Dec 2023 19:23:24 +0800 Subject: [PATCH 13/40] remove hardcode --- .github/workflows/create-release-draft.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index 70e7e0278f..c424371c66 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -186,7 +186,7 @@ jobs: fetch-depth: 0 - name: Set worker tag run: | - WORKER_TAG=$(echo "p0.10.17-9170-w0.0.1-100" | cut -d'-' -f4- | sed 's/w/v/') + WORKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f4- | sed 's/w/v/') echo "WORKER_TAG=$WORKER_TAG" >> $GITHUB_ENV - name: Set up Docker Buildx From 773df6aad993f5dd0177bac494d77a3937512f37 Mon Sep 17 00:00:00 2001 From: Verin1005 Date: Mon, 11 Dec 2023 19:28:48 +0800 Subject: [PATCH 14/40] sort && rename --- .github/workflows/create-release-draft.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index c424371c66..a2f0c6f9ee 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -171,24 +171,25 @@ jobs: if: ${{ github.event.inputs.release_worker == 'true' }} runs-on: ubuntu-latest steps: - - name: Free up disk space - if: startsWith(runner.name, 'GitHub Actions') - uses: jlumbroso/free-disk-space@main - with: - tool-cache: true - swap-storage: false - large-packages: false - name: Checkout codes on ${{ env.RELEASE_TAG }} uses: actions/checkout@v4 with: ref: ${{ env.RELEASE_TAG }} fetch-depth: 0 - - name: Set worker tag + - name: Set env run: | WORKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f4- | sed 's/w/v/') echo "WORKER_TAG=$WORKER_TAG" >> $GITHUB_ENV - + + - name: Free up disk space + if: startsWith(runner.name, 'GitHub Actions') + uses: jlumbroso/free-disk-space@main + with: + tool-cache: true + swap-storage: false + large-packages: false + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 with: From a8945b01b8b700351c9c075af2459324ea8d7e64 Mon Sep 17 00:00:00 2001 From: Verin1005 Date: Mon, 11 Dec 2023 19:56:19 +0800 Subject: [PATCH 15/40] fix tag --- .github/workflows/create-release-draft.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index a2f0c6f9ee..34cde14c7d 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -179,7 +179,7 @@ jobs: fetch-depth: 0 - name: Set env run: | - WORKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f4- | sed 's/w/v/') + WORKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f3- | sed 's/w/v/') echo "WORKER_TAG=$WORKER_TAG" >> $GITHUB_ENV - name: Free up disk space From 293b62b2b54a17c8d953b0af27df32c1bd0bfa9c Mon Sep 17 00:00:00 2001 From: Verin1005 Date: Wed, 20 Dec 2023 16:11:45 +0800 Subject: [PATCH 16/40] echo worker tag --- .github/workflows/create-release-draft.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index 34cde14c7d..41140a218a 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -180,6 +180,7 @@ jobs: - name: Set env run: | WORKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f3- | sed 's/w/v/') + echo "$WORKER_TAG" echo "WORKER_TAG=$WORKER_TAG" >> $GITHUB_ENV - name: Free up disk space From 0d10952063db642ebd69f7d3a0f2990018b68c98 Mon Sep 17 00:00:00 2001 From: Verin1005 Date: Wed, 20 Dec 2023 16:18:07 +0800 Subject: [PATCH 17/40] test tag --- .github/workflows/create-release-draft.yml | 140 +++++++++++---------- 1 file changed, 72 insertions(+), 68 deletions(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index 41140a218a..af0b52b408 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -183,77 +183,81 @@ jobs: echo "$WORKER_TAG" echo "WORKER_TAG=$WORKER_TAG" >> $GITHUB_ENV - - name: Free up disk space - if: startsWith(runner.name, 'GitHub Actions') - uses: jlumbroso/free-disk-space@main - with: - tool-cache: true - swap-storage: false - large-packages: false - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - # use the docker driver to access the local image - # we don't need external caches or multi platforms here - # see https://docs.docker.com/build/drivers/ - driver: docker + # - name: Free up disk space + # if: startsWith(runner.name, 'GitHub Actions') + # uses: jlumbroso/free-disk-space@main + # with: + # tool-cache: true + # swap-storage: false + # large-packages: false + + # - name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v3 + # with: + # # use the docker driver to access the local image + # # we don't need external caches or multi platforms here + # # see https://docs.docker.com/build/drivers/ + # driver: docker - - name: Cache worker-cache - uses: actions/cache@v3 - with: - path: | - worker-cache - key: worker-cache-${{ env.REF_VERSION }}-${{ hashFiles('tee-worker/**/Cargo.lock', 'tee-worker/**/Cargo.toml') }} - restore-keys: | - worker-cache-${{ env.REF_VERSION }}- - worker-cache- - - - name: Create cache folder if not exist - run: | - for i in 'git/db' 'registry/cache' 'registry/index' 'sccache'; do - [ ! -d "worker-cache/$i" ] && mkdir -p "worker-cache/$i" || true - echo "hello" > worker-cache/$i/nix - done - echo "::group::List worker-cache size" - du -sh worker-cache/* - echo "::endgroup::" - echo "::group::Show disk usage" - df -h . - echo "::endgroup::" - - - name: Build local builder - uses: docker/build-push-action@v5 - with: - context: . - file: tee-worker/build.Dockerfile - tags: local-builder:latest - target: builder - build-args: | - WORKER_MODE_ARG=sidechain - ADDITIONAL_FEATURES_ARG= + # - name: Cache worker-cache + # uses: actions/cache@v3 + # with: + # path: | + # worker-cache + # key: worker-cache-${{ env.REF_VERSION }}-${{ hashFiles('tee-worker/**/Cargo.lock', 'tee-worker/**/Cargo.toml') }} + # restore-keys: | + # worker-cache-${{ env.REF_VERSION }}- + # worker-cache- + + # - name: Create cache folder if not exist + # run: | + # for i in 'git/db' 'registry/cache' 'registry/index' 'sccache'; do + # [ ! -d "worker-cache/$i" ] && mkdir -p "worker-cache/$i" || true + # echo "hello" > worker-cache/$i/nix + # done + # echo "::group::List worker-cache size" + # du -sh worker-cache/* + # echo "::endgroup::" + # echo "::group::Show disk usage" + # df -h . + # echo "::endgroup::" + + # - name: Build local builder + # uses: docker/build-push-action@v5 + # with: + # context: . + # file: tee-worker/build.Dockerfile + # tags: local-builder:latest + # target: builder + # build-args: | + # WORKER_MODE_ARG=sidechain + # ADDITIONAL_FEATURES_ARG= + + # - name: Copy caches from the built image + # run: | + # echo "::group::Show disk usage" + # df -h . + # echo "::endgroup::" + # echo "::group::docker images" + # docker images --all + # echo "::endgroup::" + # echo "::group::copy cache out" + # for i in 'git/db' 'registry/cache' 'registry/index'; do + # b="${i%/*}" + # rm -rf worker-cache/$i + # docker cp "$(docker create --rm local-builder:latest):/opt/rust/$i" worker-cache/$b + # done + # rm -rf worker-cache/sccache + # docker cp "$(docker create --rm local-builder:latest):/opt/rust/sccache" worker-cache + # du -sh worker-cache/* + # echo "::endgroup::" + # echo "::group::df -h ." + # df -h . + # echo "::endgroup::" - - name: Copy caches from the built image + - name: Echo env run: | - echo "::group::Show disk usage" - df -h . - echo "::endgroup::" - echo "::group::docker images" - docker images --all - echo "::endgroup::" - echo "::group::copy cache out" - for i in 'git/db' 'registry/cache' 'registry/index'; do - b="${i%/*}" - rm -rf worker-cache/$i - docker cp "$(docker create --rm local-builder:latest):/opt/rust/$i" worker-cache/$b - done - rm -rf worker-cache/sccache - docker cp "$(docker create --rm local-builder:latest):/opt/rust/sccache" worker-cache - du -sh worker-cache/* - echo "::endgroup::" - echo "::group::df -h ." - df -h . - echo "::endgroup::" + echo "$WORKER_TAG" - name: Build worker uses: docker/build-push-action@v5 From a541f372aa41c907128a609f725c0095d145de75 Mon Sep 17 00:00:00 2001 From: Verin1005 Date: Wed, 20 Dec 2023 16:24:16 +0800 Subject: [PATCH 18/40] run echo --- .github/workflows/create-release-draft.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index af0b52b408..9dfccc7975 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -254,10 +254,6 @@ jobs: # echo "::group::df -h ." # df -h . # echo "::endgroup::" - - - name: Echo env - run: | - echo "$WORKER_TAG" - name: Build worker uses: docker/build-push-action@v5 @@ -266,6 +262,7 @@ jobs: file: tee-worker/build.Dockerfile tags: litentry/litentry-worker:$WORKER_TAG target: deployed-worker + - run: echo $WORKER_TAG - name: Build cli uses: docker/build-push-action@v5 @@ -274,6 +271,7 @@ jobs: file: tee-worker/build.Dockerfile tags: litentry/litentry-cli:$WORKER_TAG target: deployed-client + - run: echo $WORKER_TAG - run: docker images --all From 8eddcae53ccc78cbbebd95bb6365a22bd4473335 Mon Sep 17 00:00:00 2001 From: Verin1005 Date: Wed, 20 Dec 2023 16:47:23 +0800 Subject: [PATCH 19/40] echo images --- .github/workflows/create-release-draft.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index 9dfccc7975..c96857f782 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -254,6 +254,11 @@ jobs: # echo "::group::df -h ." # df -h . # echo "::endgroup::" + + - name: Echo litentry/litentry-worker:$WORKER_TAG + run: | + echo "litentry/litentry-worker:$WORKER_TAG" + echo "litentry/litentry-cli:$WORKER_TAG" - name: Build worker uses: docker/build-push-action@v5 @@ -262,7 +267,6 @@ jobs: file: tee-worker/build.Dockerfile tags: litentry/litentry-worker:$WORKER_TAG target: deployed-worker - - run: echo $WORKER_TAG - name: Build cli uses: docker/build-push-action@v5 @@ -271,7 +275,6 @@ jobs: file: tee-worker/build.Dockerfile tags: litentry/litentry-cli:$WORKER_TAG target: deployed-client - - run: echo $WORKER_TAG - run: docker images --all From 063dc77f3c7d94312644dc474fe108ba5965a773 Mon Sep 17 00:00:00 2001 From: Verin1005 Date: Wed, 20 Dec 2023 16:57:19 +0800 Subject: [PATCH 20/40] fix tag issue --- .github/workflows/create-release-draft.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index c96857f782..e46bb69244 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -179,8 +179,7 @@ jobs: fetch-depth: 0 - name: Set env run: | - WORKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f3- | sed 's/w/v/') - echo "$WORKER_TAG" + WORKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f3 | sed 's/w/v/') echo "WORKER_TAG=$WORKER_TAG" >> $GITHUB_ENV # - name: Free up disk space From 7bac6ec265dc8fe4d21f56280b0678f866b859d6 Mon Sep 17 00:00:00 2001 From: Verin1005 Date: Wed, 20 Dec 2023 17:00:22 +0800 Subject: [PATCH 21/40] test hard code tag --- .github/workflows/create-release-draft.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index e46bb69244..7ce14ba328 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -179,7 +179,7 @@ jobs: fetch-depth: 0 - name: Set env run: | - WORKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f3 | sed 's/w/v/') + WORKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f3- | sed 's/w/v/') echo "WORKER_TAG=$WORKER_TAG" >> $GITHUB_ENV # - name: Free up disk space @@ -264,7 +264,7 @@ jobs: with: context: . file: tee-worker/build.Dockerfile - tags: litentry/litentry-worker:$WORKER_TAG + tags: litentry/litentry-worker:v0.0.1-100 target: deployed-worker - name: Build cli @@ -272,7 +272,7 @@ jobs: with: context: . file: tee-worker/build.Dockerfile - tags: litentry/litentry-cli:$WORKER_TAG + tags: litentry/litentry-cli:v0.0.1-100 target: deployed-client - run: docker images --all From 059a2aecc140f409420a6564c37227c88029d63b Mon Sep 17 00:00:00 2001 From: Verin1005 Date: Wed, 20 Dec 2023 17:13:10 +0800 Subject: [PATCH 22/40] fix tag parameters --- .github/workflows/create-release-draft.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index 7ce14ba328..2d65c14ef5 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -254,17 +254,12 @@ jobs: # df -h . # echo "::endgroup::" - - name: Echo litentry/litentry-worker:$WORKER_TAG - run: | - echo "litentry/litentry-worker:$WORKER_TAG" - echo "litentry/litentry-cli:$WORKER_TAG" - - name: Build worker uses: docker/build-push-action@v5 with: context: . file: tee-worker/build.Dockerfile - tags: litentry/litentry-worker:v0.0.1-100 + tags: litentry/litentry-worker:${{ env.WORKER_TAG }} target: deployed-worker - name: Build cli @@ -272,7 +267,7 @@ jobs: with: context: . file: tee-worker/build.Dockerfile - tags: litentry/litentry-cli:v0.0.1-100 + tags: litentry/litentry-cli:${{ env.WORKER_TAG }} target: deployed-client - run: docker images --all From 77c8237a9f0f090768b7eae63fc54a621db46f76 Mon Sep 17 00:00:00 2001 From: Verin1005 Date: Wed, 20 Dec 2023 17:29:29 +0800 Subject: [PATCH 23/40] uncomment --- .github/workflows/create-release-draft.yml | 138 ++++++++++----------- 1 file changed, 69 insertions(+), 69 deletions(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index 2d65c14ef5..bb776dfe55 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -182,77 +182,77 @@ jobs: WORKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f3- | sed 's/w/v/') echo "WORKER_TAG=$WORKER_TAG" >> $GITHUB_ENV - # - name: Free up disk space - # if: startsWith(runner.name, 'GitHub Actions') - # uses: jlumbroso/free-disk-space@main - # with: - # tool-cache: true - # swap-storage: false - # large-packages: false - - # - name: Set up Docker Buildx - # uses: docker/setup-buildx-action@v3 - # with: - # # use the docker driver to access the local image - # # we don't need external caches or multi platforms here - # # see https://docs.docker.com/build/drivers/ - # driver: docker + - name: Free up disk space + if: startsWith(runner.name, 'GitHub Actions') + uses: jlumbroso/free-disk-space@main + with: + tool-cache: true + swap-storage: false + large-packages: false + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + # use the docker driver to access the local image + # we don't need external caches or multi platforms here + # see https://docs.docker.com/build/drivers/ + driver: docker - # - name: Cache worker-cache - # uses: actions/cache@v3 - # with: - # path: | - # worker-cache - # key: worker-cache-${{ env.REF_VERSION }}-${{ hashFiles('tee-worker/**/Cargo.lock', 'tee-worker/**/Cargo.toml') }} - # restore-keys: | - # worker-cache-${{ env.REF_VERSION }}- - # worker-cache- - - # - name: Create cache folder if not exist - # run: | - # for i in 'git/db' 'registry/cache' 'registry/index' 'sccache'; do - # [ ! -d "worker-cache/$i" ] && mkdir -p "worker-cache/$i" || true - # echo "hello" > worker-cache/$i/nix - # done - # echo "::group::List worker-cache size" - # du -sh worker-cache/* - # echo "::endgroup::" - # echo "::group::Show disk usage" - # df -h . - # echo "::endgroup::" - - # - name: Build local builder - # uses: docker/build-push-action@v5 - # with: - # context: . - # file: tee-worker/build.Dockerfile - # tags: local-builder:latest - # target: builder - # build-args: | - # WORKER_MODE_ARG=sidechain - # ADDITIONAL_FEATURES_ARG= + - name: Cache worker-cache + uses: actions/cache@v3 + with: + path: | + worker-cache + key: worker-cache-${{ env.REF_VERSION }}-${{ hashFiles('tee-worker/**/Cargo.lock', 'tee-worker/**/Cargo.toml') }} + restore-keys: | + worker-cache-${{ env.REF_VERSION }}- + worker-cache- + + - name: Create cache folder if not exist + run: | + for i in 'git/db' 'registry/cache' 'registry/index' 'sccache'; do + [ ! -d "worker-cache/$i" ] && mkdir -p "worker-cache/$i" || true + echo "hello" > worker-cache/$i/nix + done + echo "::group::List worker-cache size" + du -sh worker-cache/* + echo "::endgroup::" + echo "::group::Show disk usage" + df -h . + echo "::endgroup::" + + - name: Build local builder + uses: docker/build-push-action@v5 + with: + context: . + file: tee-worker/build.Dockerfile + tags: local-builder:latest + target: builder + build-args: | + WORKER_MODE_ARG=sidechain + ADDITIONAL_FEATURES_ARG= - # - name: Copy caches from the built image - # run: | - # echo "::group::Show disk usage" - # df -h . - # echo "::endgroup::" - # echo "::group::docker images" - # docker images --all - # echo "::endgroup::" - # echo "::group::copy cache out" - # for i in 'git/db' 'registry/cache' 'registry/index'; do - # b="${i%/*}" - # rm -rf worker-cache/$i - # docker cp "$(docker create --rm local-builder:latest):/opt/rust/$i" worker-cache/$b - # done - # rm -rf worker-cache/sccache - # docker cp "$(docker create --rm local-builder:latest):/opt/rust/sccache" worker-cache - # du -sh worker-cache/* - # echo "::endgroup::" - # echo "::group::df -h ." - # df -h . - # echo "::endgroup::" + - name: Copy caches from the built image + run: | + echo "::group::Show disk usage" + df -h . + echo "::endgroup::" + echo "::group::docker images" + docker images --all + echo "::endgroup::" + echo "::group::copy cache out" + for i in 'git/db' 'registry/cache' 'registry/index'; do + b="${i%/*}" + rm -rf worker-cache/$i + docker cp "$(docker create --rm local-builder:latest):/opt/rust/$i" worker-cache/$b + done + rm -rf worker-cache/sccache + docker cp "$(docker create --rm local-builder:latest):/opt/rust/sccache" worker-cache + du -sh worker-cache/* + echo "::endgroup::" + echo "::group::df -h ." + df -h . + echo "::endgroup::" - name: Build worker uses: docker/build-push-action@v5 From e4d6b9dfb39b2abc6e68945a21135117913cbdfb Mon Sep 17 00:00:00 2001 From: Igor Trofimov Date: Fri, 12 Jan 2024 12:46:11 +0000 Subject: [PATCH 24/40] split parachain and worker versions --- .github/workflows/create-release-draft.yml | 67 +++++++++++----------- 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index 4805fb57b9..54207f615f 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -23,7 +23,10 @@ on: description: tee-enclave required: true default: true - release_tag: + parachain_release_tag: + description: an existing tag for creating release (e.g. v1.2.3) + required: true + tee_release_tag: description: an existing tag for creating release (e.g. v1.2.3) required: true diff_tag: @@ -40,7 +43,8 @@ on: - litentry env: - RELEASE_TAG: ${{ github.event.inputs.release_tag }} + PARACHAIN_RELEASE_TAG: ${{ github.event.inputs.parachain_release_tag }} + WORKER_RELEASE_TAG: ${{ github.event.inputs.tee_release_tag }} DIFF_TAG: ${{ github.event.inputs.diff_tag }} GENESIS_RELEASE: ${{ github.event.inputs.genesis_release }} DOCKER_BUILDKIT: 1 @@ -120,15 +124,15 @@ jobs: if: ${{ github.event.inputs.release_client == 'true' }} runs-on: ubuntu-latest steps: - - name: Checkout codes on ${{ env.RELEASE_TAG }} + - name: Checkout codes on ${{ env.PARACHAIN_RELEASE_TAG }} uses: actions/checkout@v4 with: - ref: ${{ env.RELEASE_TAG }} + ref: ${{ env.PARACHAIN_RELEASE_TAG }} fetch-depth: 0 - name: Set env run: | - DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') + DOCKER_TAG=$(echo ${{ env.PARACHAIN_RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') echo "DOCKER_TAG=$DOCKER_TAG" >> $GITHUB_ENV - name: Build docker image @@ -171,15 +175,14 @@ jobs: if: ${{ github.event.inputs.release_worker == 'true' }} runs-on: ubuntu-latest steps: - - - name: Checkout codes on ${{ env.RELEASE_TAG }} + - name: Checkout codes on ${{ env.WORKER_RELEASE_TAG }} uses: actions/checkout@v4 with: - ref: ${{ env.RELEASE_TAG }} + ref: ${{ env.WORKER_RELEASE_TAG }} fetch-depth: 0 - name: Set env run: | - WORKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f3- | sed 's/w/v/') + WORKER_TAG=$(echo ${{ env.WORKER_RELEASE_TAG }} | cut -d'-' -f3- | sed 's/w/v/') echo "WORKER_TAG=$WORKER_TAG" >> $GITHUB_ENV - name: Free up disk space @@ -197,7 +200,7 @@ jobs: # we don't need external caches or multi platforms here # see https://docs.docker.com/build/drivers/ driver: docker - + - name: Cache worker-cache uses: actions/cache@v3 with: @@ -231,7 +234,7 @@ jobs: build-args: | WORKER_MODE_ARG=sidechain ADDITIONAL_FEATURES_ARG= - + - name: Copy caches from the built image run: | echo "::group::Show disk usage" @@ -253,7 +256,7 @@ jobs: echo "::group::df -h ." df -h . echo "::endgroup::" - + - name: Build worker uses: docker/build-push-action@v5 with: @@ -269,7 +272,7 @@ jobs: file: tee-worker/build.Dockerfile tags: litentry/litentry-cli:${{ env.WORKER_TAG }} target: deployed-client - + - run: docker images --all - name: Dockerhub login @@ -292,14 +295,14 @@ jobs: enclave_sha1sum: ${{ steps.shasum.outputs.enclave_sha1sum }} worker_sha1sum: ${{ steps.shasum.outputs.worker_sha1sum }} steps: - - name: Checkout codes on ${{ env.RELEASE_TAG }} + - name: Checkout codes on ${{ env.WORKER_RELEASE_TAG }} uses: actions/checkout@v4 with: - ref: ${{ env.RELEASE_TAG }} + ref: ${{ env.WORKER_RELEASE_TAG }} fetch-depth: 0 - - name: Build release artefacts - run: | + - name: Build release artefacts + run: | source /opt/intel/sgxsdk/environment ./tee-worker/scripts/litentry/release/build.sh ${{ github.event.inputs.release_worker }} ${{ github.event.inputs.release_enclave }} @@ -331,7 +334,7 @@ jobs: - name: Fail early if: failure() uses: andymckay/cancel-action@0.3 - + ## test again the built docker image ## run-ts-tests: runs-on: ubuntu-latest @@ -352,7 +355,7 @@ jobs: - name: Download and tag docker image run: | - export DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') + export DOCKER_TAG=$(echo ${{ env.PARACHAIN_RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') docker pull litentry/litentry-parachain:$DOCKER_TAG docker tag litentry/litentry-parachain:$DOCKER_TAG litentry/litentry-parachain:latest @@ -392,12 +395,12 @@ jobs: - name: Checkout sources uses: actions/checkout@v4 with: - ref: ${{ env.RELEASE_TAG }} + ref: ${{ env.PARACHAIN_RELEASE_TAG }} - name: Prepare output and compare the metadata timeout-minutes: 3 run: | - export DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') + export DOCKER_TAG=$(echo ${{ env.PARACHAIN_RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') PARACHAIN_NAME=local-parachain BASE_URL=ws://127.0.0.1:9944 chain=${{ matrix.chain }} @@ -406,7 +409,7 @@ jobs: echo "Date: $(date)" >> output-$chain.txt echo "Base: $BASE_URL" >> output-$chain.txt echo "Reference: $REF_URL" >> output-$chain.txt - echo "Target Tag: ${{ env.RELEASE_TAG }}" >> output-$chain.txt + echo "Target Tag: ${{ env.PARACHAIN_RELEASE_TAG }}" >> output-$chain.txt echo "Chain: $chain" >> output-$chain.txt echo "----------------------------------------------------------------------" >> output-$chain.txt echo "Running parachain: $chain" @@ -427,16 +430,16 @@ jobs: uses: actions-cool/issues-helper@v3 id: findissueid with: - actions: 'find-issues' + actions: "find-issues" token: ${{ secrets.GITHUB_TOKEN }} - issue-state: 'open' - title-includes: Litentry-parachain ${{ env.RELEASE_TAG }} Release checklist - + issue-state: "open" + title-includes: Litentry-parachain ${{ env.PARACHAIN_RELEASE_TAG }} Release checklist + - name: Create comment if: ${{ steps.findissueid.outputs.issues }} != '[]' uses: actions-cool/issues-helper@v3 with: - actions: 'create-comment' + actions: "create-comment" token: ${{ secrets.GITHUB_TOKEN }} issue-number: ${{ fromJson(steps.findissueid.outputs.issues)[0].number }} body: | @@ -451,12 +454,12 @@ jobs: - set-release-type - build-tee - run-ts-tests - - build-wasm + - build-wasm if: | !failure() && (success('build-wasm') || success('run-ts-tests') || success('build-tee')) steps: - - name: Checkout codes on ${{ env.RELEASE_TAG }} + - name: Checkout codes on ${{ env.WORKER_RELEASE_TAG }} uses: actions/checkout@v4 with: ref: ${{ env.RELEASE_TAG }} @@ -464,7 +467,7 @@ jobs: - name: Download all artefacts uses: actions/download-artifact@v3 - + - name: Generate release notes run: | export MRENCLAVE="${{ needs.build-tee.outputs.mrenclave }}" @@ -478,8 +481,8 @@ jobs: id: create-release-draft uses: softprops/action-gh-release@v1 with: - tag_name: ${{ env.RELEASE_TAG }} - name: Litentry-parachain ${{ env.RELEASE_TAG }} + tag_name: ${{ env.PARACHAIN_RELEASE_TAG }}-${{ env.WORKER_RELEASE_TAG }} + name: Litentry-parachain ${{ env.PARACHAIN_RELEASE_TAG }}-${{ env.WORKER_RELEASE_TAG }} body_path: ${{ github.workspace }}/.github/release_notes.md draft: true files: | From 0651173e32fb7727e4b311803bf4127ad0e992dd Mon Sep 17 00:00:00 2001 From: Igor Trofimov Date: Fri, 12 Jan 2024 12:51:36 +0000 Subject: [PATCH 25/40] adjust inputs description --- .github/workflows/create-release-draft.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index 54207f615f..d216f12c63 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -24,13 +24,13 @@ on: required: true default: true parachain_release_tag: - description: an existing tag for creating release (e.g. v1.2.3) + description: Parachain release tag (e.g. v1.2.3) required: true - tee_release_tag: - description: an existing tag for creating release (e.g. v1.2.3) + worker_release_tag: + description: Worker release tag (e.g. w0.0.1-102) required: true diff_tag: - description: an existing tag to run diff against (e.g. v1.2.0) + description: an existing tag to run diff against (e.g. v1.2.0-w0.0.1-101) default: "" required: false genesis_release: @@ -44,7 +44,7 @@ on: env: PARACHAIN_RELEASE_TAG: ${{ github.event.inputs.parachain_release_tag }} - WORKER_RELEASE_TAG: ${{ github.event.inputs.tee_release_tag }} + WORKER_RELEASE_TAG: ${{ github.event.inputs.worker_release_tag }} DIFF_TAG: ${{ github.event.inputs.diff_tag }} GENESIS_RELEASE: ${{ github.event.inputs.genesis_release }} DOCKER_BUILDKIT: 1 From a32a5e9e8091be8d30fc7780390d19b1d5af11ba Mon Sep 17 00:00:00 2001 From: Igor Trofimov Date: Fri, 12 Jan 2024 13:00:51 +0000 Subject: [PATCH 26/40] correct version name for draft release --- .github/workflows/create-release-draft.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index d216f12c63..89e3cf4f89 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -24,13 +24,13 @@ on: required: true default: true parachain_release_tag: - description: Parachain release tag (e.g. v1.2.3) + description: Parachain release tag (e.g. 1.2.3-101) required: true worker_release_tag: - description: Worker release tag (e.g. w0.0.1-102) + description: Worker release tag (e.g. 0.0.1-102) required: true diff_tag: - description: an existing tag to run diff against (e.g. v1.2.0-w0.0.1-101) + description: an existing tag to run diff against (e.g. p1.2.0-w0.0.1-101) default: "" required: false genesis_release: @@ -459,10 +459,10 @@ jobs: !failure() && (success('build-wasm') || success('run-ts-tests') || success('build-tee')) steps: - - name: Checkout codes on ${{ env.WORKER_RELEASE_TAG }} + - name: Checkout codes on ${{ env.PARACHAIN_RELEASE_TAG }}-${{ env.WORKER_RELEASE_TAG }} uses: actions/checkout@v4 with: - ref: ${{ env.RELEASE_TAG }} + ref: ${{ env.PARACHAIN_RELEASE_TAG }}-${{ env.WORKER_RELEASE_TAG }} fetch-depth: 0 - name: Download all artefacts From 2582d9eca907a5ee7dc66e90b4bf7b339afd3893 Mon Sep 17 00:00:00 2001 From: Igor Trofimov Date: Mon, 15 Jan 2024 10:22:11 +0000 Subject: [PATCH 27/40] rolback to release version --- .github/workflows/create-release-draft.yml | 42 ++++++++++------------ 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index 89e3cf4f89..b5b51c685a 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -23,12 +23,9 @@ on: description: tee-enclave required: true default: true - parachain_release_tag: + release_tag: description: Parachain release tag (e.g. 1.2.3-101) required: true - worker_release_tag: - description: Worker release tag (e.g. 0.0.1-102) - required: true diff_tag: description: an existing tag to run diff against (e.g. p1.2.0-w0.0.1-101) default: "" @@ -43,8 +40,7 @@ on: - litentry env: - PARACHAIN_RELEASE_TAG: ${{ github.event.inputs.parachain_release_tag }} - WORKER_RELEASE_TAG: ${{ github.event.inputs.worker_release_tag }} + RELEASE_TAG: ${{ github.event.inputs.release_tag }} DIFF_TAG: ${{ github.event.inputs.diff_tag }} GENESIS_RELEASE: ${{ github.event.inputs.genesis_release }} DOCKER_BUILDKIT: 1 @@ -124,15 +120,15 @@ jobs: if: ${{ github.event.inputs.release_client == 'true' }} runs-on: ubuntu-latest steps: - - name: Checkout codes on ${{ env.PARACHAIN_RELEASE_TAG }} + - name: Checkout codes on ${{ env.RELEASE_TAG }} uses: actions/checkout@v4 with: - ref: ${{ env.PARACHAIN_RELEASE_TAG }} + ref: ${{ env.RELEASE_TAG }} fetch-depth: 0 - name: Set env run: | - DOCKER_TAG=$(echo ${{ env.PARACHAIN_RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') + DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') echo "DOCKER_TAG=$DOCKER_TAG" >> $GITHUB_ENV - name: Build docker image @@ -175,14 +171,14 @@ jobs: if: ${{ github.event.inputs.release_worker == 'true' }} runs-on: ubuntu-latest steps: - - name: Checkout codes on ${{ env.WORKER_RELEASE_TAG }} + - name: Checkout codes on ${{ env.RELEASE_TAG }} uses: actions/checkout@v4 with: - ref: ${{ env.WORKER_RELEASE_TAG }} + ref: ${{ env.RELEASE_TAG }} fetch-depth: 0 - name: Set env run: | - WORKER_TAG=$(echo ${{ env.WORKER_RELEASE_TAG }} | cut -d'-' -f3- | sed 's/w/v/') + WORKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f3- | sed 's/w/v/') echo "WORKER_TAG=$WORKER_TAG" >> $GITHUB_ENV - name: Free up disk space @@ -295,10 +291,10 @@ jobs: enclave_sha1sum: ${{ steps.shasum.outputs.enclave_sha1sum }} worker_sha1sum: ${{ steps.shasum.outputs.worker_sha1sum }} steps: - - name: Checkout codes on ${{ env.WORKER_RELEASE_TAG }} + - name: Checkout codes on ${{ env.RELEASE_TAG }} uses: actions/checkout@v4 with: - ref: ${{ env.WORKER_RELEASE_TAG }} + ref: ${{ env.RELEASE_TAG }} fetch-depth: 0 - name: Build release artefacts @@ -355,7 +351,7 @@ jobs: - name: Download and tag docker image run: | - export DOCKER_TAG=$(echo ${{ env.PARACHAIN_RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') + export DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') docker pull litentry/litentry-parachain:$DOCKER_TAG docker tag litentry/litentry-parachain:$DOCKER_TAG litentry/litentry-parachain:latest @@ -395,12 +391,12 @@ jobs: - name: Checkout sources uses: actions/checkout@v4 with: - ref: ${{ env.PARACHAIN_RELEASE_TAG }} + ref: ${{ env.RELEASE_TAG }} - name: Prepare output and compare the metadata timeout-minutes: 3 run: | - export DOCKER_TAG=$(echo ${{ env.PARACHAIN_RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') + export DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') PARACHAIN_NAME=local-parachain BASE_URL=ws://127.0.0.1:9944 chain=${{ matrix.chain }} @@ -409,7 +405,7 @@ jobs: echo "Date: $(date)" >> output-$chain.txt echo "Base: $BASE_URL" >> output-$chain.txt echo "Reference: $REF_URL" >> output-$chain.txt - echo "Target Tag: ${{ env.PARACHAIN_RELEASE_TAG }}" >> output-$chain.txt + echo "Target Tag: ${{ env.RELEASE_TAG }}" >> output-$chain.txt echo "Chain: $chain" >> output-$chain.txt echo "----------------------------------------------------------------------" >> output-$chain.txt echo "Running parachain: $chain" @@ -433,7 +429,7 @@ jobs: actions: "find-issues" token: ${{ secrets.GITHUB_TOKEN }} issue-state: "open" - title-includes: Litentry-parachain ${{ env.PARACHAIN_RELEASE_TAG }} Release checklist + title-includes: Litentry-parachain ${{ env.RELEASE_TAG }} Release checklist - name: Create comment if: ${{ steps.findissueid.outputs.issues }} != '[]' @@ -459,10 +455,10 @@ jobs: !failure() && (success('build-wasm') || success('run-ts-tests') || success('build-tee')) steps: - - name: Checkout codes on ${{ env.PARACHAIN_RELEASE_TAG }}-${{ env.WORKER_RELEASE_TAG }} + - name: Checkout codes on ${{ env.RELEASE_TAG }} uses: actions/checkout@v4 with: - ref: ${{ env.PARACHAIN_RELEASE_TAG }}-${{ env.WORKER_RELEASE_TAG }} + ref: ${{ env.RELEASE_TAG }} fetch-depth: 0 - name: Download all artefacts @@ -481,8 +477,8 @@ jobs: id: create-release-draft uses: softprops/action-gh-release@v1 with: - tag_name: ${{ env.PARACHAIN_RELEASE_TAG }}-${{ env.WORKER_RELEASE_TAG }} - name: Litentry-parachain ${{ env.PARACHAIN_RELEASE_TAG }}-${{ env.WORKER_RELEASE_TAG }} + tag_name: ${{ env.RELEASE_TAG }} + name: Litentry-parachain ${{ env.RELEASE_TAG }} body_path: ${{ github.workspace }}/.github/release_notes.md draft: true files: | From cf8775fe8cbecd88b9d53f4e08f708554b1e852c Mon Sep 17 00:00:00 2001 From: Igor Trofimov Date: Mon, 15 Jan 2024 11:49:42 +0000 Subject: [PATCH 28/40] include patch version to the image --- .github/workflows/create-release-draft.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index b5b51c685a..0ea2d7023a 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -24,10 +24,10 @@ on: required: true default: true release_tag: - description: Parachain release tag (e.g. 1.2.3-101) + description: an existing tag for creating release (e.g. p1.2.0-w0.0.1-101) required: true diff_tag: - description: an existing tag to run diff against (e.g. p1.2.0-w0.0.1-101) + description: an existing tag to run diff against (e.g. p1.1.0-w0.0.1-100) default: "" required: false genesis_release: @@ -396,7 +396,7 @@ jobs: - name: Prepare output and compare the metadata timeout-minutes: 3 run: | - export DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') + export DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1-2 | sed 's/p/v/') PARACHAIN_NAME=local-parachain BASE_URL=ws://127.0.0.1:9944 chain=${{ matrix.chain }} From cae2983f156c204eeb28b4bbb508d12f53bd6b21 Mon Sep 17 00:00:00 2001 From: Igor Trofimov Date: Mon, 15 Jan 2024 14:57:20 +0000 Subject: [PATCH 29/40] fix included patch number --- .github/workflows/create-release-draft.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index 0ea2d7023a..b5fa890d50 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -128,7 +128,7 @@ jobs: - name: Set env run: | - DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') + DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1-2 | sed 's/p/v/') echo "DOCKER_TAG=$DOCKER_TAG" >> $GITHUB_ENV - name: Build docker image @@ -351,7 +351,7 @@ jobs: - name: Download and tag docker image run: | - export DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/') + export DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1-2 | sed 's/p/v/') docker pull litentry/litentry-parachain:$DOCKER_TAG docker tag litentry/litentry-parachain:$DOCKER_TAG litentry/litentry-parachain:latest From dea5314a7b02ac8676248b8c8ee8fae2948aa56b Mon Sep 17 00:00:00 2001 From: Igor Trofimov Date: Mon, 15 Jan 2024 15:08:40 +0000 Subject: [PATCH 30/40] include exception for shorter version --- .github/workflows/create-release-draft.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index b5fa890d50..4e9988a534 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -128,7 +128,7 @@ jobs: - name: Set env run: | - DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1-2 | sed 's/p/v/') + DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1-2 | sed 's/p/v/' | sed 's/-w.*//') echo "DOCKER_TAG=$DOCKER_TAG" >> $GITHUB_ENV - name: Build docker image @@ -351,7 +351,7 @@ jobs: - name: Download and tag docker image run: | - export DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1-2 | sed 's/p/v/') + export DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1-2 | sed 's/p/v/' | sed 's/-w.*//') docker pull litentry/litentry-parachain:$DOCKER_TAG docker tag litentry/litentry-parachain:$DOCKER_TAG litentry/litentry-parachain:latest @@ -396,7 +396,7 @@ jobs: - name: Prepare output and compare the metadata timeout-minutes: 3 run: | - export DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1-2 | sed 's/p/v/') + export DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1-2 | sed 's/p/v/' | sed 's/-w.*//') PARACHAIN_NAME=local-parachain BASE_URL=ws://127.0.0.1:9944 chain=${{ matrix.chain }} From 9861dbaa9787383248d53acc8d26663958a17290 Mon Sep 17 00:00:00 2001 From: Igor Trofimov Date: Tue, 16 Jan 2024 10:26:04 +0000 Subject: [PATCH 31/40] simplify ts release package + refactoring --- .github/workflows/create-release-draft.yml | 8 ++-- .github/workflows/release-ts-api-package.yml | 43 +++++++++----------- 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/.github/workflows/create-release-draft.yml b/.github/workflows/create-release-draft.yml index 4e9988a534..62c3f510ef 100644 --- a/.github/workflows/create-release-draft.yml +++ b/.github/workflows/create-release-draft.yml @@ -128,7 +128,7 @@ jobs: - name: Set env run: | - DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1-2 | sed 's/p/v/' | sed 's/-w.*//') + DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | sed 's/p/v/;s/\(.*\)-w.*/\1/') echo "DOCKER_TAG=$DOCKER_TAG" >> $GITHUB_ENV - name: Build docker image @@ -178,7 +178,7 @@ jobs: fetch-depth: 0 - name: Set env run: | - WORKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f3- | sed 's/w/v/') + WORKER_TAG=$(echo ${{ env.RELEASE_TAG }} | sed 's/.*\(w.*\)/\1/;s/w/v/') echo "WORKER_TAG=$WORKER_TAG" >> $GITHUB_ENV - name: Free up disk space @@ -351,7 +351,7 @@ jobs: - name: Download and tag docker image run: | - export DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1-2 | sed 's/p/v/' | sed 's/-w.*//') + export DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | sed 's/p/v/;s/\(.*\)-w.*/\1/') docker pull litentry/litentry-parachain:$DOCKER_TAG docker tag litentry/litentry-parachain:$DOCKER_TAG litentry/litentry-parachain:latest @@ -396,7 +396,7 @@ jobs: - name: Prepare output and compare the metadata timeout-minutes: 3 run: | - export DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1-2 | sed 's/p/v/' | sed 's/-w.*//') + export DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | sed 's/p/v/;s/\(.*\)-w.*/\1/') PARACHAIN_NAME=local-parachain BASE_URL=ws://127.0.0.1:9944 chain=${{ matrix.chain }} diff --git a/.github/workflows/release-ts-api-package.yml b/.github/workflows/release-ts-api-package.yml index 5505c02816..e58296e0cd 100644 --- a/.github/workflows/release-ts-api-package.yml +++ b/.github/workflows/release-ts-api-package.yml @@ -3,19 +3,10 @@ name: Release Ts API Package on: workflow_dispatch: - inputs: - parachain-tag: - description: 'Parachain docker image tag' - required: true - default: 'latest' - worker-tag: - description: 'Worker docker image tag' - required: true - default: 'latest' - release-tag: - description: 'Client-api release tag' - required: true - default: 'latest' + inputs: + release-tag: + description: "Client-api release tag (e.g. p1.2.0-9701-w0.0.1-101)" + required: true env: NODE_AUTH_TOKEN: ${{ secrets.RELEASE_TS_API_PACKAGE_TOKEN }} @@ -25,18 +16,24 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Set ENV + run: | + # extracting parachain version and worker version from release tag + echo "PARACHAIN_TAG=(echo ${{inputs.release-tag}} | sed 's/p/v/;s/\(.*\)-w.*/\1/')" >> $GITHUB_ENV + echo "WORKER_TAG=(echo ${{inputs.release-tag}} | sed 's/.*\(w.*\)/\1/;s/w/v/')" >> $GITHUB_ENV + - name: Pull litentry image optionally run: | docker pull parity/polkadot - docker pull litentry/litentry-worker:${{ inputs.worker-tag }} - docker pull litentry/litentry-cli:${{ inputs.worker-tag }} - docker pull litentry/litentry-parachain:${{ inputs.parachain-tag }} + docker pull litentry/litentry-worker:$WORKER_TAG + docker pull litentry/litentry-cli:$WORKER_TAG + docker pull litentry/litentry-parachain:$PARACHAIN_TAG - name: Re-tag docker image run: | - docker tag litentry/litentry-worker:${{ inputs.worker-tag }} litentry/litentry-worker:latest - docker tag litentry/litentry-cli:${{ inputs.worker-tag }} litentry/litentry-cli:latest - docker tag litentry/litentry-parachain:${{ inputs.parachain-tag }} litentry/litentry-parachain:latest + docker tag litentry/litentry-worker:$WORKER_TAG litentry/litentry-worker:latest + docker tag litentry/litentry-cli:$WORKER_TAG litentry/litentry-cli:latest + docker tag litentry/litentry-parachain:$PARACHAIN_TAG litentry/litentry-parachain:latest - run: docker images --all @@ -51,7 +48,7 @@ jobs: run: | cd tee-worker/docker docker compose -f litentry-parachain.build.yml build - + - name: Update metadata and generate types timeout-minutes: 10 run: | @@ -83,8 +80,8 @@ jobs: echo "$api dist and build files do not exist. Publishing failed." exit 1 fi - - npm publish --tag ${{ inputs.release-tag }} + echo release tag: ${{ inputs.release-tag }} for $api + # hide for now npm publish --tag ${{ inputs.release-tag }} echo "------------------------$api published------------------------" cd .. @@ -109,4 +106,4 @@ jobs: with: name: logs-lit-ts-api-package-build path: logs - if-no-files-found: ignore \ No newline at end of file + if-no-files-found: ignore From 9c05391f6a50b8822ff3a953f9377fb2e1b2cea9 Mon Sep 17 00:00:00 2001 From: Igor Trofimov Date: Tue, 16 Jan 2024 10:43:16 +0000 Subject: [PATCH 32/40] fix script typo --- .github/workflows/release-ts-api-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-ts-api-package.yml b/.github/workflows/release-ts-api-package.yml index e58296e0cd..e70d1066b3 100644 --- a/.github/workflows/release-ts-api-package.yml +++ b/.github/workflows/release-ts-api-package.yml @@ -19,8 +19,8 @@ jobs: - name: Set ENV run: | # extracting parachain version and worker version from release tag - echo "PARACHAIN_TAG=(echo ${{inputs.release-tag}} | sed 's/p/v/;s/\(.*\)-w.*/\1/')" >> $GITHUB_ENV - echo "WORKER_TAG=(echo ${{inputs.release-tag}} | sed 's/.*\(w.*\)/\1/;s/w/v/')" >> $GITHUB_ENV + echo "PARACHAIN_TAG=$(echo ${{inputs.release-tag}} | sed 's/p/v/;s/\(.*\)-w.*/\1/')" >> $GITHUB_ENV + echo "WORKER_TAG=$(echo ${{inputs.release-tag}} | sed 's/.*\(w.*\)/\1/;s/w/v/')" >> $GITHUB_ENV - name: Pull litentry image optionally run: | From 6046b557876a85fefc85b76cd1304fb4d4ac646d Mon Sep 17 00:00:00 2001 From: Igor Trofimov Date: Tue, 16 Jan 2024 14:45:45 +0000 Subject: [PATCH 33/40] check without timeout --- .github/workflows/release-ts-api-package.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release-ts-api-package.yml b/.github/workflows/release-ts-api-package.yml index e70d1066b3..9fd84fe7f1 100644 --- a/.github/workflows/release-ts-api-package.yml +++ b/.github/workflows/release-ts-api-package.yml @@ -50,7 +50,6 @@ jobs: docker compose -f litentry-parachain.build.yml build - name: Update metadata and generate types - timeout-minutes: 10 run: | cd tee-worker/docker docker compose -f docker-compose.yml -f lit-ts-api-package-build.yml up --no-build --exit-code-from lit-ts-api-package-build lit-ts-api-package-build From 8924412a0eb78567d0a4019b05f764d5d3093057 Mon Sep 17 00:00:00 2001 From: Igor Trofimov Date: Wed, 17 Jan 2024 15:51:47 +0000 Subject: [PATCH 34/40] debug artefacts --- .github/workflows/release-ts-api-package.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/release-ts-api-package.yml b/.github/workflows/release-ts-api-package.yml index 9fd84fe7f1..cfc18f0ea1 100644 --- a/.github/workflows/release-ts-api-package.yml +++ b/.github/workflows/release-ts-api-package.yml @@ -42,8 +42,17 @@ jobs: - name: Generate parachain artefacts run: | + echo "checking docker volumes and generated artifacts" + docker volume ls + ls -la docker + ls -la tee-worker/docker ./tee-worker/scripts/litentry/generate_parachain_artefacts.sh + echo "checking docker volumes and generated artifacts after" + docker volume ls + ls -la docker + ls -la tee-worker/docker + - name: Build litentry parachain docker images run: | cd tee-worker/docker From a0054cede0ab748a21a8c76531638e0003c27eb7 Mon Sep 17 00:00:00 2001 From: Igor Trofimov Date: Thu, 18 Jan 2024 13:22:25 +0000 Subject: [PATCH 35/40] check with started worker --- tee-worker/docker/lit-ts-api-package-build.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tee-worker/docker/lit-ts-api-package-build.yml b/tee-worker/docker/lit-ts-api-package-build.yml index 979cc7205e..350783fe06 100644 --- a/tee-worker/docker/lit-ts-api-package-build.yml +++ b/tee-worker/docker/lit-ts-api-package-build.yml @@ -13,11 +13,10 @@ services: litentry-node: condition: service_healthy litentry-worker-1: - condition: service_healthy + condition: service_started networks: - litentry-test-network - entrypoint: - "/usr/local/worker-cli/lit_ts_api_package_build.sh -p 9912 -u ws://litentry-node + entrypoint: "/usr/local/worker-cli/lit_ts_api_package_build.sh -p 9912 -u ws://litentry-node -W http://litentry-node -V wss://litentry-worker-1 -A 2011 -C /usr/local/bin/litentry-cli 2>&1" restart: "no" networks: From 244221e53a939fa5fa2d6b221ae64c6031eb1deb Mon Sep 17 00:00:00 2001 From: Igor Trofimov Date: Fri, 19 Jan 2024 09:46:55 +0000 Subject: [PATCH 36/40] add comment --- tee-worker/docker/lit-ts-api-package-build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tee-worker/docker/lit-ts-api-package-build.yml b/tee-worker/docker/lit-ts-api-package-build.yml index 350783fe06..21fcd8e135 100644 --- a/tee-worker/docker/lit-ts-api-package-build.yml +++ b/tee-worker/docker/lit-ts-api-package-build.yml @@ -13,6 +13,9 @@ services: litentry-node: condition: service_healthy litentry-worker-1: + # using +service_started+ over +service_healthy+ since worker runs successfully but can not connect to parachain + # as requires additional pre-setup for parachain image which built in production mode + # for generating types there is no need for fully workable interaction between worker and parachain condition: service_started networks: - litentry-test-network From ab29516373c3398e25720c8c2c7889a237d584b0 Mon Sep 17 00:00:00 2001 From: Igor Trofimov Date: Fri, 19 Jan 2024 10:00:18 +0000 Subject: [PATCH 37/40] cleanup --- .github/workflows/release-ts-api-package.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/release-ts-api-package.yml b/.github/workflows/release-ts-api-package.yml index cfc18f0ea1..9fd84fe7f1 100644 --- a/.github/workflows/release-ts-api-package.yml +++ b/.github/workflows/release-ts-api-package.yml @@ -42,17 +42,8 @@ jobs: - name: Generate parachain artefacts run: | - echo "checking docker volumes and generated artifacts" - docker volume ls - ls -la docker - ls -la tee-worker/docker ./tee-worker/scripts/litentry/generate_parachain_artefacts.sh - echo "checking docker volumes and generated artifacts after" - docker volume ls - ls -la docker - ls -la tee-worker/docker - - name: Build litentry parachain docker images run: | cd tee-worker/docker From ac3df19fa075782793f59662ea8b61f049a1c811 Mon Sep 17 00:00:00 2001 From: Igor Trofimov Date: Fri, 19 Jan 2024 10:16:40 +0000 Subject: [PATCH 38/40] debugging --- tee-worker/cli/lit_ts_api_package_build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tee-worker/cli/lit_ts_api_package_build.sh b/tee-worker/cli/lit_ts_api_package_build.sh index 0d962815eb..7618dfb64e 100755 --- a/tee-worker/cli/lit_ts_api_package_build.sh +++ b/tee-worker/cli/lit_ts_api_package_build.sh @@ -42,8 +42,8 @@ echo "Using client binary $CLIENT_BIN" echo "Using node uri $NODEURL:$NPORT" echo "Using trusted-worker uri $WORKER1URL:$WORKER1PORT" echo "Using node http uri $NODEHTTPURL:$NPORT" -echo "" - +echo "sleeping for 20 secs IGOR DEBUG" +sleep 20 cd /client-api/parachain-api curl -s -H "Content-Type: application/json" -d '{"id": "1", "jsonrpc": "2.0", "method": "state_getMetadata", "params": []}' $NODEHTTPURL:$NPORT > prepare-build/litentry-parachain-metadata.json echo "update parachain metadata" From b86b527674569e073d3c3cf43c65afa4bf2655c6 Mon Sep 17 00:00:00 2001 From: Igor Trofimov Date: Fri, 19 Jan 2024 10:49:23 +0000 Subject: [PATCH 39/40] add meaningful comment --- tee-worker/cli/lit_ts_api_package_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tee-worker/cli/lit_ts_api_package_build.sh b/tee-worker/cli/lit_ts_api_package_build.sh index 7618dfb64e..684833b7c5 100755 --- a/tee-worker/cli/lit_ts_api_package_build.sh +++ b/tee-worker/cli/lit_ts_api_package_build.sh @@ -42,7 +42,7 @@ echo "Using client binary $CLIENT_BIN" echo "Using node uri $NODEURL:$NPORT" echo "Using trusted-worker uri $WORKER1URL:$WORKER1PORT" echo "Using node http uri $NODEHTTPURL:$NPORT" -echo "sleeping for 20 secs IGOR DEBUG" +echo "waiting 20 secs worker to run successfully" sleep 20 cd /client-api/parachain-api curl -s -H "Content-Type: application/json" -d '{"id": "1", "jsonrpc": "2.0", "method": "state_getMetadata", "params": []}' $NODEHTTPURL:$NPORT > prepare-build/litentry-parachain-metadata.json From 15dddb337dcaca0e8fa3154340745735cb9c95f8 Mon Sep 17 00:00:00 2001 From: Igor Trofimov Date: Fri, 19 Jan 2024 12:53:52 +0000 Subject: [PATCH 40/40] uncommit publishing packages --- .github/workflows/release-ts-api-package.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/release-ts-api-package.yml b/.github/workflows/release-ts-api-package.yml index 9fd84fe7f1..b61bc5d52a 100644 --- a/.github/workflows/release-ts-api-package.yml +++ b/.github/workflows/release-ts-api-package.yml @@ -79,8 +79,7 @@ jobs: echo "$api dist and build files do not exist. Publishing failed." exit 1 fi - echo release tag: ${{ inputs.release-tag }} for $api - # hide for now npm publish --tag ${{ inputs.release-tag }} + npm publish --tag ${{ inputs.release-tag }} echo "------------------------$api published------------------------" cd ..