From 642b002b8d05afde7ba430b5adc2ae6df9adebcf Mon Sep 17 00:00:00 2001 From: "v.oleynikov" Date: Tue, 30 Jul 2024 09:49:34 +0300 Subject: [PATCH] [CI] Fixed runners and added dev registry cleanup Signed-off-by: v.oleynikov --- .github/workflows/build_dev.yml | 2 +- .github/workflows/build_prod.yml | 8 ++-- .github/workflows/checks.yaml | 2 +- .github/workflows/deploy_dev.yml | 2 +- .github/workflows/deploy_prod.yml | 10 ++--- .github/workflows/dev_registry-cleanup.yml | 47 ++++++++++++++++++++++ 6 files changed, 59 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/dev_registry-cleanup.yml diff --git a/.github/workflows/build_dev.yml b/.github/workflows/build_dev.yml index 877bb804..40c8e670 100644 --- a/.github/workflows/build_dev.yml +++ b/.github/workflows/build_dev.yml @@ -18,7 +18,7 @@ on: jobs: dev_setup_build: - runs-on: ubuntu-latest + runs-on: [self-hosted, regular, selectel] name: Build and Push images steps: - name: Set vars for PR diff --git a/.github/workflows/build_prod.yml b/.github/workflows/build_prod.yml index 6ea87224..52d497d1 100644 --- a/.github/workflows/build_prod.yml +++ b/.github/workflows/build_prod.yml @@ -18,7 +18,7 @@ on: jobs: prod_ce_setup_build: - runs-on: ubuntu-latest + runs-on: [self-hosted, regular, selectel] name: Build and Push CE steps: - name: SET VAR @@ -37,7 +37,7 @@ jobs: - uses: deckhouse/modules-actions/build@v1 prod_ee_setup_build: - runs-on: ubuntu-latest + runs-on: [self-hosted, regular, selectel] name: Build and Push EE steps: - name: SET VAR @@ -56,7 +56,7 @@ jobs: - uses: deckhouse/modules-actions/build@v1 prod_fe_setup_build: - runs-on: ubuntu-latest + runs-on: [self-hosted, regular, selectel] name: Build and Push FE steps: - name: SET VAR @@ -75,7 +75,7 @@ jobs: - uses: deckhouse/modules-actions/build@v1 prod_se_setup_build: - runs-on: ubuntu-latest + runs-on: [self-hosted, regular, selectel] name: Build and Push SE steps: - name: SET VAR diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 33427554..7cc0314c 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -7,7 +7,7 @@ on: jobs: release-label: name: Release note label - runs-on: ubuntu-latest + runs-on: [self-hosted, regular] steps: - name: Check minimum labels diff --git a/.github/workflows/deploy_dev.yml b/.github/workflows/deploy_dev.yml index 5d2e31b8..6b008d62 100644 --- a/.github/workflows/deploy_dev.yml +++ b/.github/workflows/deploy_dev.yml @@ -37,7 +37,7 @@ on: jobs: deploy-dev: - runs-on: ubuntu-latest + runs-on: [self-hosted, regular, selectel] name: Deploy dev steps: - name: PRINT VARS diff --git a/.github/workflows/deploy_prod.yml b/.github/workflows/deploy_prod.yml index 9b52e928..73b58d15 100644 --- a/.github/workflows/deploy_prod.yml +++ b/.github/workflows/deploy_prod.yml @@ -45,7 +45,7 @@ on: jobs: print-vars: - runs-on: ubuntu-latest + runs-on: [self-hosted, regular, selectel] name: Print vars steps: - name: PRINT VARS @@ -60,7 +60,7 @@ jobs: job-CE: name: Edition CE - runs-on: ubuntu-latest + runs-on: [self-hosted, regular, selectel] if: github.event.inputs.ce == 'true' steps: - run: echo "CE" @@ -80,7 +80,7 @@ jobs: job-EE: name: Edition EE - runs-on: ubuntu-latest + runs-on: [self-hosted, regular, selectel] if: github.event.inputs.ee == 'true' steps: - run: echo "EE" @@ -100,7 +100,7 @@ jobs: job-FE: name: Edition FE - runs-on: ubuntu-latest + runs-on: [self-hosted, regular, selectel] if: github.event.inputs.fe == 'true' steps: - run: echo "FE" @@ -120,7 +120,7 @@ jobs: job-SE: name: Edition SE - runs-on: ubuntu-latest + runs-on: [self-hosted, regular, selectel] if: github.event.inputs.se == 'true' steps: - run: echo "SE" diff --git a/.github/workflows/dev_registry-cleanup.yml b/.github/workflows/dev_registry-cleanup.yml new file mode 100644 index 00000000..3176b367 --- /dev/null +++ b/.github/workflows/dev_registry-cleanup.yml @@ -0,0 +1,47 @@ +# Copyright 2024 Flant JSC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Cleanup dev registries + +env: + MODULES_REGISTRY: ${{ vars.DEV_REGISTRY }} + CI_COMMIT_REF_NAME: ${{ github.ref_name }} + MODULES_MODULE_NAME: ${{ vars.MODULE_NAME }} + MODULES_MODULE_SOURCE: ${{ vars.DEV_MODULE_SOURCE }} + MODULES_REGISTRY_LOGIN: ${{ vars.DEV_MODULES_REGISTRY_LOGIN }} + MODULES_REGISTRY_PASSWORD: ${{ secrets.DEV_MODULES_REGISTRY_PASSWORD }} + WERF_DRY_RUN: "false" + +on: + workflow_dispatch: + schedule: + - cron: "12 0 * * 6" + +defaults: + run: + shell: bash + +jobs: + lint: + runs-on: [self-hosted, regular, selectel] + name: Run cleanup + steps: + - uses: actions/checkout@v4 + - uses: deckhouse/modules-actions/setup@v1 + + - name: Cleanup + run: | + werf cleanup \ + --repo ${MODULES_MODULE_SOURCE}/${MODULES_MODULE_NAME} \ + --without-kube=true --config werf_cleanup.yaml