diff --git a/.github/workflows/dev_module_build-on-self-hosted-runner.yml b/.github/workflows/dev_module_build-on-self-hosted-runner.yml index 61cb6cdd7..41fcf66df 100644 --- a/.github/workflows/dev_module_build-on-self-hosted-runner.yml +++ b/.github/workflows/dev_module_build-on-self-hosted-runner.yml @@ -46,24 +46,35 @@ jobs: name: Check label run: echo "should_run=true" >> $GITHUB_OUTPUT - show_dev_manifest: - needs: check_label + set_vars: + runs-on: ubuntu-latest + name: Set MODULES_MODULE_TAG if: needs.check_label.outputs.should_run - runs-on: [self-hosted, ci-testing] - name: Show manifest + needs: check_label + outputs: + modules_module_tag: ${{ steps.modules_module_tag.outputs.MODULES_MODULE_TAG }} steps: - - name: Set vars for PR - if: ${{ github.ref_name != 'main' }} + - name: Set vars + id: modules_module_tag run: | - MODULES_MODULE_TAG="$(echo ${{github.event.pull_request.number}})" - echo "MODULES_MODULE_TAG=$MODULES_MODULE_TAG" >> "$GITHUB_ENV" + if [[ "${{ github.ref_name }}" == 'pre-alpha' || "${{ github.ref_name }}" == 'main' ]]; then + MODULES_MODULE_TAG="${{ github.ref_name }}" + else + MODULES_MODULE_TAG="pr${{ github.event.pull_request.number }}" + fi - - name: Set vars for main - if: ${{ github.ref_name == 'main' }} - run: | - MODULES_MODULE_TAG="$(echo v0.0.0-${{ github.ref_name }})" - echo "MODULES_MODULE_TAG=$MODULES_MODULE_TAG" >> "$GITHUB_ENV" + echo "MODULES_MODULE_TAG=$MODULES_MODULE_TAG" >> "$GITHUB_OUTPUT" + show_dev_manifest: + name: Show manifest + if: needs.check_label.outputs.should_run + needs: + - check_label + - set_vars + runs-on: [self-hosted, ci-testing] + env: + MODULES_MODULE_TAG: ${{needs.set_vars.outputs.modules_module_tag}} + steps: - name: Show dev config run: | cat << OUTER @@ -105,10 +116,11 @@ jobs: OUTER lint_go: - needs: check_label + name: Run go linter if: needs.check_label.outputs.should_run + needs: + - check_label runs-on: [self-hosted, ci-testing] - name: Run go linter steps: - name: Set up Go 1.21 uses: actions/setup-go@v5 @@ -128,10 +140,11 @@ jobs: task virtualization-controller:lint:go lint_yaml: - needs: check_label + name: Run yaml linter if: needs.check_label.outputs.should_run + needs: + - check_label runs-on: [self-hosted, ci-testing] - name: Run yaml linter steps: - name: Install Task uses: arduino/setup-task@v2 @@ -146,10 +159,11 @@ jobs: run: task -p lint:prettier:yaml test: - needs: check_label + name: Run unit test if: needs.check_label.outputs.should_run + needs: + - check_label runs-on: [self-hosted, ci-testing] - name: Run unit test steps: - name: Set up Go 1.21 uses: actions/setup-go@v5 @@ -173,23 +187,15 @@ jobs: task virtualization-controller:test:unit dev_setup_build: - needs: check_label + name: Build and Push images if: needs.check_label.outputs.should_run + needs: + - check_label + - set_vars runs-on: [self-hosted, ci-testing] - name: Build and Push images + env: + MODULES_MODULE_TAG: ${{needs.set_vars.outputs.modules_module_tag}} steps: - - name: Set vars for PR - if: ${{ github.ref_name != 'main' }} - run: | - MODULES_MODULE_TAG="$(echo pr${{github.event.pull_request.number}})" - echo "MODULES_MODULE_TAG=$MODULES_MODULE_TAG" >> "$GITHUB_ENV" - - - name: Set vars for main - if: ${{ github.ref_name == 'main' }} - run: | - MODULES_MODULE_TAG="$(echo v0.0.0-${{ github.ref_name }})" - echo "MODULES_MODULE_TAG=$MODULES_MODULE_TAG" >> "$GITHUB_ENV" - - name: Print vars run: | echo MODULES_REGISTRY=$MODULES_REGISTRY @@ -201,13 +207,10 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + + - name: Remove unwanted software + uses: ./.github/actions/remove-unwanted-software + - uses: deckhouse/modules-actions/setup@v1 - - uses: deckhouse/modules-actions/build@v1 - - run: | - IMAGE_SRC="$(jq -r '.Images."bundle".DockerImageName' images_tags_werf.json)" - IMAGE_DST="$(jq -r '.Images.bundle.DockerRepo' images_tags_werf.json):main" - echo "✨ Bundle image : Pushing ${IMAGE_SRC} to ${IMAGE_DST}" - crane copy ${IMAGE_SRC} ${IMAGE_DST} - if: ${{ github.ref_name == 'main' }} - name: Bundle image tag main + - uses: deckhouse/modules-actions/build@v1 diff --git a/.github/workflows/dev_module_build.yml b/.github/workflows/dev_module_build.yml index 4c709083f..159e6f534 100644 --- a/.github/workflows/dev_module_build.yml +++ b/.github/workflows/dev_module_build.yml @@ -52,7 +52,7 @@ jobs: if [[ "${{ github.ref_name }}" == 'pre-alpha' || "${{ github.ref_name }}" == 'main' ]]; then MODULES_MODULE_TAG="${{ github.ref_name }}" else - MODULES_MODULE_TAG="$(echo pr${{ github.event.pull_request.number }})" + MODULES_MODULE_TAG="pr${{ github.event.pull_request.number }}" fi echo "MODULES_MODULE_TAG=$MODULES_MODULE_TAG" >> "$GITHUB_OUTPUT" @@ -191,11 +191,3 @@ jobs: - uses: deckhouse/modules-actions/setup@v1 - uses: deckhouse/modules-actions/build@v1 - - - run: | - IMAGE_SRC="$(jq -r '.Images."bundle".DockerImageName' images_tags_werf.json)" - IMAGE_DST="$(jq -r '.Images.bundle.DockerRepo' images_tags_werf.json):v0.0.0-main" - echo "✨ Bundle image : Pushing ${IMAGE_SRC} to ${IMAGE_DST}" - crane copy ${IMAGE_SRC} ${IMAGE_DST} - if: ${{ github.ref_name == 'main' }} - name: Push legacy module tag v0.0.0-main diff --git a/.github/workflows/dev_registry-cleanup.yml b/.github/workflows/dev_registry-cleanup.yml index b5c150f65..029e27024 100644 --- a/.github/workflows/dev_registry-cleanup.yml +++ b/.github/workflows/dev_registry-cleanup.yml @@ -21,7 +21,7 @@ env: MODULES_MODULE_SOURCE: ${{ vars.DEV_MODULE_SOURCE }} MODULES_REGISTRY_LOGIN: ${{ vars.DEV_MODULES_REGISTRY_LOGIN }} MODULES_REGISTRY_PASSWORD: ${{ secrets.DEV_MODULES_REGISTRY_PASSWORD }} - MODULES_MODULE_TAG: v0.0.0-main + MODULES_MODULE_TAG: main WERF_DRY_RUN: "false" on: