From e63019b5f8539e72df9ee85caec978f8ad3e0e33 Mon Sep 17 00:00:00 2001 From: sarmstrong Date: Wed, 16 Sep 2026 10:09:17 +0300 Subject: [PATCH 1/3] Fix marketplace cleanup action --- .gitea/workflows/werf-cleanup-template.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitea/workflows/werf-cleanup-template.yml b/.gitea/workflows/werf-cleanup-template.yml index 88d6981..74c8c75 100644 --- a/.gitea/workflows/werf-cleanup-template.yml +++ b/.gitea/workflows/werf-cleanup-template.yml @@ -14,6 +14,10 @@ on: default: false required: false type: boolean + vite_oauth_callback_url: + required: false + type: string + default: "" secrets: VAULT_ROLE_ID: required: true @@ -27,6 +31,8 @@ jobs: cleanup: name: Cleanup runs-on: ubuntu-latest + env: + VITE_OAUTH_CALLBACK_URL: ${{ inputs.vite_oauth_callback_url }} steps: - uses: https://github.com/actions/checkout@v3 - name: Fetch all history for all tags and branches From 55ecf03665dd55c79b5bd9ec7bdde48d8e0b542f Mon Sep 17 00:00:00 2001 From: sarmstrong Date: Wed, 16 Sep 2026 12:14:11 +0300 Subject: [PATCH 2/3] Add VITE_API_URL --- .gitea/workflows/werf-cleanup-template.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitea/workflows/werf-cleanup-template.yml b/.gitea/workflows/werf-cleanup-template.yml index 74c8c75..fe0b928 100644 --- a/.gitea/workflows/werf-cleanup-template.yml +++ b/.gitea/workflows/werf-cleanup-template.yml @@ -18,6 +18,10 @@ on: required: false type: string default: "" + vite_api_url: + required: false + type: string + default: "" secrets: VAULT_ROLE_ID: required: true @@ -33,6 +37,7 @@ jobs: runs-on: ubuntu-latest env: VITE_OAUTH_CALLBACK_URL: ${{ inputs.vite_oauth_callback_url }} + VITE_API_URL: ${{ inputs.vite_api_url }} steps: - uses: https://github.com/actions/checkout@v3 - name: Fetch all history for all tags and branches From d46381158744cf503c6ae332364cb9c8ec38d74a Mon Sep 17 00:00:00 2001 From: sarmstrong Date: Tue, 22 Sep 2026 09:48:27 +0300 Subject: [PATCH 3/3] Refactor the fix. --- .gitea/workflows/werf-cleanup-template.yml | 11 --- .../werf-marketplace-cleanup-template.yml | 77 +++++++++++++++++++ 2 files changed, 77 insertions(+), 11 deletions(-) create mode 100644 .gitea/workflows/werf-marketplace-cleanup-template.yml diff --git a/.gitea/workflows/werf-cleanup-template.yml b/.gitea/workflows/werf-cleanup-template.yml index fe0b928..88d6981 100644 --- a/.gitea/workflows/werf-cleanup-template.yml +++ b/.gitea/workflows/werf-cleanup-template.yml @@ -14,14 +14,6 @@ on: default: false required: false type: boolean - vite_oauth_callback_url: - required: false - type: string - default: "" - vite_api_url: - required: false - type: string - default: "" secrets: VAULT_ROLE_ID: required: true @@ -35,9 +27,6 @@ jobs: cleanup: name: Cleanup runs-on: ubuntu-latest - env: - VITE_OAUTH_CALLBACK_URL: ${{ inputs.vite_oauth_callback_url }} - VITE_API_URL: ${{ inputs.vite_api_url }} steps: - uses: https://github.com/actions/checkout@v3 - name: Fetch all history for all tags and branches diff --git a/.gitea/workflows/werf-marketplace-cleanup-template.yml b/.gitea/workflows/werf-marketplace-cleanup-template.yml new file mode 100644 index 0000000..fe0b928 --- /dev/null +++ b/.gitea/workflows/werf-marketplace-cleanup-template.yml @@ -0,0 +1,77 @@ +name: Cleanup Docker registry +on: + workflow_call: + inputs: + docker_repo_path: + default: private.docker.wilix.dev + required: false + type: string + docker_images_path: + description: 'Относительный путь для образов проекта' + required: true + type: string + werf_debug: + default: false + required: false + type: boolean + vite_oauth_callback_url: + required: false + type: string + default: "" + vite_api_url: + required: false + type: string + default: "" + secrets: + VAULT_ROLE_ID: + required: true + VAULT_SECRET_ID: + required: true + +env: + vault_main_base_path: dev/wilix/main/data/ci + +jobs: + cleanup: + name: Cleanup + runs-on: ubuntu-latest + env: + VITE_OAUTH_CALLBACK_URL: ${{ inputs.vite_oauth_callback_url }} + VITE_API_URL: ${{ inputs.vite_api_url }} + steps: + - uses: https://github.com/actions/checkout@v3 + - name: Fetch all history for all tags and branches + run: git fetch --prune --unshallow + + # FIXME Эти секреты нужно будет сделать полностью различными для проектов, идеально - краткосрочные генерируемые vault + - id: import-secrets + uses: https://github.com/hashicorp/vault-action@v2 + with: + url: https://vault.wilix.dev + method: approle + roleId: ${{ secrets.VAULT_ROLE_ID }} + secretId: ${{ secrets.VAULT_SECRET_ID }} + secrets: | + ${{ env.vault_main_base_path }} local_cluster_kube_config_base64 ; + ${{ env.vault_main_base_path }} docker_registry_username ; + ${{ env.vault_main_base_path }} docker_registry_password ; + + - name: Login to wilix nexus Container Registry + uses: https://github.com/docker/login-action@v2 + with: + registry: ${{ inputs.docker_repo_path }} + username: ${{ steps.import-secrets.outputs.docker_registry_username }} + password: ${{ steps.import-secrets.outputs.docker_registry_password }} + + - name: Install werf + uses: https://github.com/werf/actions/install@v1.2 + + - name: Setup debug if need + if: ${{ inputs.werf_debug }} + run: echo "WERF_LOG_DEBUG=true" >> "$GITHUB_ENV" + + - name: Cleanup + run: werf cleanup + env: + WERF_REPO: ${{ inputs.docker_repo_path }}/${{ inputs.docker_images_path }} + WERF_KUBECONFIG_BASE64: ${{ steps.import-secrets.outputs.local_cluster_kube_config_base64 }}