From 73d923f57add48a54a4d0999d79c60c4455effaf Mon Sep 17 00:00:00 2001 From: Vasily Oleynikov Date: Tue, 30 Jul 2024 15:27:32 +0300 Subject: [PATCH] [CI] Fixed runners and added dev registry cleanup (#7) Signed-off-by: v.oleynikov --- .github/workflows/build_dev.yml | 2 +- .github/workflows/build_prod.yml | 6 +-- .github/workflows/checks.yaml | 2 +- .github/workflows/deploy_dev.yml | 2 +- .github/workflows/deploy_prod.yml | 8 ++-- .github/workflows/dev_registry-cleanup.yml | 47 ++++++++++++++++++++++ werf_cleanup.yaml | 12 ++++++ 7 files changed, 69 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/dev_registry-cleanup.yml create mode 100644 werf_cleanup.yaml diff --git a/.github/workflows/build_dev.yml b/.github/workflows/build_dev.yml index 0930de9..c42c46c 100644 --- a/.github/workflows/build_dev.yml +++ b/.github/workflows/build_dev.yml @@ -19,7 +19,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 fb19f1e..a3f788a 100644 --- a/.github/workflows/build_prod.yml +++ b/.github/workflows/build_prod.yml @@ -19,7 +19,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 @@ -38,7 +38,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 @@ -57,7 +57,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 diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 3342755..7cc0314 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 defc7ae..d10d552 100644 --- a/.github/workflows/deploy_dev.yml +++ b/.github/workflows/deploy_dev.yml @@ -39,7 +39,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 39c2a67..5962aa4 100644 --- a/.github/workflows/deploy_prod.yml +++ b/.github/workflows/deploy_prod.yml @@ -42,7 +42,7 @@ on: jobs: print-vars: - runs-on: ubuntu-latest + runs-on: [self-hosted, regular, selectel] name: Print vars steps: - name: PRINT VARS @@ -57,7 +57,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" @@ -77,7 +77,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" @@ -97,7 +97,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" diff --git a/.github/workflows/dev_registry-cleanup.yml b/.github/workflows/dev_registry-cleanup.yml new file mode 100644 index 0000000..3176b36 --- /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 diff --git a/werf_cleanup.yaml b/werf_cleanup.yaml new file mode 100644 index 0000000..3f63df9 --- /dev/null +++ b/werf_cleanup.yaml @@ -0,0 +1,12 @@ +project: csi-huawei +configVersion: 1 +cleanup: + keepPolicies: + - references: + branch: /.*/ + limit: + in: 168h # keep dev images build during last week which not main|pre-alpha + - references: + branch: /main|pre-alpha/ + imagesPerReference: + last: 5 # keep 5 images for branches main|pre-alpha