Cleanup container registry #720
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Cleanup container registry | |
on: | |
workflow_dispatch: | |
branches: | |
- '*' | |
schedule: | |
- cron: '0 2 * * *' | |
repository_dispatch: | |
types: [cleanup] | |
jobs: | |
cleanup: | |
name: Cleanup | |
runs-on: self-hosted | |
env: | |
WERF_SECRET_KEY: ${{ secrets.WERF_SECRET_KEY }} | |
WERF_PARALLEL: 0 | |
steps: | |
- name: Login to Sbercloud Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ secrets.DOCKER_REGISTRY }} | |
username: ${{ secrets.SBERCLOUD_CR_USERNAME }} | |
password: ${{ secrets.SBERCLOUD_CR_PASSWORD }} | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.SSH_DOCK_SERVER_PRIVATE_KEY }} | |
name: id_rsa | |
known_hosts: ${{ secrets.SSH_DOCK_SERVER_KNOWN_HOSTS }} | |
if_key_exists: replace | |
- name: Set env for branch name | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF##*/} | sed 's/\_/-/g')" >> $GITHUB_ENV | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
ssh-key: ${{ secrets.SSH_DOCK_SERVER_PRIVATE_KEY }} | |
- name: Fetch all history for all tags and branches | |
run: | | |
if $(git rev-parse --is-shallow-repository) | |
then | |
git fetch --prune --unshallow | |
else | |
git fetch --prune | |
fi | |
- name: Cleanup | |
uses: werf/actions/[email protected] | |
with: | |
kube-config-base64-data: ${{ secrets.KUBECONFIG_BASE64_PROD_BACKUP_CLUSTER }} | |
env: | |
WERF_REPO: ${{ secrets.DOCKER_REGISTRY }}/condo/condo | |
WERF_REPO_CONTAINER_REGISTRY: default |