Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): remove 0.0.0 main tag #141

Merged
merged 7 commits into from
Jun 20, 2024
85 changes: 44 additions & 41 deletions .github/workflows/dev_module_build-on-self-hosted-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
universal-itengineer marked this conversation as resolved.
Show resolved Hide resolved
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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
10 changes: 1 addition & 9 deletions .github/workflows/dev_module_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/dev_registry-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading