Skip to content

Commit

Permalink
[CI] Fixed runners and added dev registry cleanup (#7)
Browse files Browse the repository at this point in the history
Signed-off-by: v.oleynikov <vasily.oleynikov@flant.com>
  • Loading branch information
duckhawk authored Jul 30, 2024
1 parent d36a8bb commit 73d923f
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/deploy_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/dev_registry-cleanup.yml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions werf_cleanup.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 73d923f

Please sign in to comment.