From 57f3a93dfa005500628bc4b47912f9cb00a894de Mon Sep 17 00:00:00 2001 From: Kirill Azovtsev Date: Mon, 3 Feb 2025 03:06:29 +0300 Subject: [PATCH] skip jobs (polkadot builder workflow) --- .github/workflows/zombie-builder.yml | 45 ++++++++++++++----- zombienet/docker/Makefile.include/polkadot.mk | 10 +++-- .../docker/Makefile.include/variables.mk | 4 +- 3 files changed, 43 insertions(+), 16 deletions(-) diff --git a/.github/workflows/zombie-builder.yml b/.github/workflows/zombie-builder.yml index b2936e53cf..e1185df690 100644 --- a/.github/workflows/zombie-builder.yml +++ b/.github/workflows/zombie-builder.yml @@ -80,28 +80,41 @@ jobs: env: PLATFORM: ${{ matrix.platform }} steps: + - name: "Сheck if polkadot_builder is required" + run: | + if [ "${{ github.event.inputs.polkadot_builder }}" != "true" ]; then + echo "Polkadot Builder is not required" + echo "skip=true" >> $GITHUB_ENV + fi + - name: Checkout repository + if: env.skip != 'true' uses: actions/checkout@v4 with: fetch-depth: 0 - name: Fetch master branch + if: env.skip != 'true' run: git fetch origin master:master - name : "Authenticate with Google Cloud" + if: env.skip != 'true' uses: 'google-github-actions/auth@v2' with: credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }} - name: "Set up Cloud SDK" + if: env.skip != 'true' uses: 'google-github-actions/setup-gcloud@v2' - name: "Configure Docker for GCR" + if: env.skip != 'true' run: | gcloud auth configure-docker --quiet gcloud auth configure-docker ${{ secrets.GCP_REGISTRY }} --quiet - name: "Check if image tag exists using Makefile" + if: env.skip != 'true' id: check-tag working-directory: ./zombienet/docker run: | @@ -112,11 +125,11 @@ jobs: - name: "Build Polkadot Builder" working-directory: ./zombienet/docker - if: env.exists == 'false' || github.event.inputs.polkadot_builder == 'true' + if: env.exists == 'false' || env.skip != 'true' run: make polkadot_builder && make polkadot_builder_push - name: "Versions Info" - if: always() + if: always() && env.skip != 'true' working-directory: ./zombienet/docker run: | make polkadot_builder_image_info @@ -126,28 +139,41 @@ jobs: timeout-minutes: 60 needs: [build_polkadot_builder] steps: + - name: "Сheck if polkadot_builder is required" + run: | + if [ "${{ github.event.inputs.polkadot_builder }}" != "true" ]; then + echo "Polkadot Builder is not required" + echo "skip=true" >> $GITHUB_ENV + fi + - name: Checkout repository + if: env.skip != 'true' uses: actions/checkout@v4 with: fetch-depth: 0 - name: Fetch master branch + if: env.skip != 'true' run: git fetch origin master:master - name : "Authenticate with Google Cloud" + if: env.skip != 'true' uses: 'google-github-actions/auth@v2' with: credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }} - name: "Set up Cloud SDK" + if: env.skip != 'true' uses: 'google-github-actions/setup-gcloud@v2' - name: "Configure Docker for GCR" + if: env.skip != 'true' run: | gcloud auth configure-docker --quiet gcloud auth configure-docker ${{ secrets.GCP_REGISTRY }} --quiet - name: "Check if image tag exists using Makefile" + if: env.skip != 'true' id: check-tag working-directory: ./zombienet/docker run: | @@ -158,17 +184,18 @@ jobs: - name: "Build Polkadot Builder" working-directory: ./zombienet/docker - if: env.exists == 'false' || github.event.inputs.polkadot_builder == 'true' + if: env.exists == 'false' || env.skip != 'true' run: make polkadot_builder_push_manifest - name: "Versions Info" - if: always() + if: always() && env.skip != 'true' working-directory: ./zombienet/docker run: | make polkadot_builder_image_info building_binaries: + if: github.event.inputs.polkadot_binaries == 'true' runs-on: [ self-hosted, qdrvm-arm64 ] # runs-on: ${{ matrix.os }} # strategy: @@ -192,10 +219,10 @@ jobs: - name: Fetch master branch run: git fetch origin master:master - - uses: actions/cache@v4 - with: - path: ${{ env.CACHE_PATHS }} - key: ${{ runner.os }}-rust-${{ env.CACHE_VERSION }} +# - uses: actions/cache@v4 +# with: +# path: ${{ env.CACHE_PATHS }} +# key: ${{ runner.os }}-rust-${{ env.CACHE_VERSION }} - name: "Authenticate with Google Cloud" uses: 'google-github-actions/auth@v2' @@ -211,12 +238,10 @@ jobs: gcloud auth configure-docker ${{ secrets.GCP_REGISTRY }} --quiet - name: "Build target" - if: github.event.inputs.polkadot_binaries == 'true' working-directory: ./zombienet/docker run: make polkadot_binary - name: "Push Polkadot APT Package" - if: github.event.inputs.polkadot_binaries == 'true' working-directory: ./zombienet/docker run: make upload_apt_package diff --git a/zombienet/docker/Makefile.include/polkadot.mk b/zombienet/docker/Makefile.include/polkadot.mk index b4139397aa..190438cd94 100644 --- a/zombienet/docker/Makefile.include/polkadot.mk +++ b/zombienet/docker/Makefile.include/polkadot.mk @@ -50,6 +50,7 @@ docker_run: set_versions docker_start_clean docker run -d --name $(POLKADOT_BUILD_CONTAINER_NAME) \ --platform $(PLATFORM) \ --entrypoint "/bin/bash" \ + --user root \ -e RUSTC_WRAPPER=sccache \ -e SCCACHE_GCS_RW_MODE=READ_WRITE \ -e SCCACHE_VERSION=$(SCCACHE_VERSION) \ @@ -61,15 +62,16 @@ docker_run: set_versions docker_start_clean -e ARCHITECTURE=$(ARCHITECTURE) \ -e POLKADOT_SDK_RELEASE=$(POLKADOT_SDK_RELEASE) \ -v $(GOOGLE_APPLICATION_CREDENTIALS):$(IN_DOCKER_WORKING_DIR)/.gcp/google_creds.json \ - -v ./$(DOCKER_BUILD_DIR_NAME)/polkadot_binary:/tmp/polkadot_binary \ - -v ./$(DOCKER_BUILD_DIR_NAME)/cargo/registry:$(IN_DOCKER_WORKING_DIR)/.cargo/registry/ \ - -v ./$(DOCKER_BUILD_DIR_NAME)/cargo/git:$(IN_DOCKER_WORKING_DIR)/.cargo/git/ \ + -v ./build_apt_package.sh:$(IN_DOCKER_WORKING_DIR)/build_apt_package.sh \ -v ./$(DOCKER_BUILD_DIR_NAME)/home:$(IN_DOCKER_WORKING_DIR) \ -v ./$(DOCKER_BUILD_DIR_NAME)/tmp:/tmp/ \ - -v ./build_apt_package.sh:$(IN_DOCKER_WORKING_DIR)/build_apt_package.sh \ $(DOCKER_REGISTRY_PATH)polkadot_builder:$(BUILDER_LATEST_TAG) \ -c "tail -f /dev/null" +# -v ./$(DOCKER_BUILD_DIR_NAME)/cargo/registry:$(IN_DOCKER_WORKING_DIR)/.cargo/registry/ \ +# -v ./$(DOCKER_BUILD_DIR_NAME)/cargo/git:$(IN_DOCKER_WORKING_DIR)/.cargo/git/ \ +# -v ./$(DOCKER_BUILD_DIR_NAME)/polkadot_binary:/tmp/polkadot_binary \ + docker_exec: set_versions docker exec -t $(POLKADOT_BUILD_CONTAINER_NAME) /bin/bash -c \ "git config --global --add safe.directory \"*\" ; \ diff --git a/zombienet/docker/Makefile.include/variables.mk b/zombienet/docker/Makefile.include/variables.mk index 185b7c069d..96744ac412 100644 --- a/zombienet/docker/Makefile.include/variables.mk +++ b/zombienet/docker/Makefile.include/variables.mk @@ -16,8 +16,8 @@ GOOGLE_APPLICATION_CREDENTIALS ?= OS_IMAGE ?= $(OS_IMAGE_NAME):$(OS_IMAGE_TAG)@sha256:$(OS_IMAGE_HASH) OS_IMAGE_TAG_WITH_HASH := $(OS_IMAGE_TAG)@sha256:$(OS_IMAGE_HASH) OS_IMAGE_SHORT_HASH := $(shell echo $(OS_IMAGE_HASH) | cut -c1-7) -USER_ID = 5555 #$(shell id -u) -GROUP_ID = 5555 #$(shell id -g) +USER_ID = 5555 +GROUP_ID = 5555 # polkadot_builder Variables POLKADOT_SDK_TAG ?=