start gh actions workflows #32
Workflow file for this run
This file contains hidden or 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: WG-Easy PR Validation - build, release, install | |
| on: | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - 'applications/wg-easy/**' | |
| - '.github/workflows/wg-easy-pr-validation.yaml' | |
| workflow_dispatch: | |
| inputs: | |
| test_mode: | |
| description: 'Run in test mode' | |
| required: false | |
| default: 'true' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| APP_DIR: applications/wg-easy | |
| REPLICATED_API_TOKEN: ${{ secrets.WG_EASY_REPLICATED_API_TOKEN }} | |
| REPLICATED_APP: ${{ secrets.WG_EASY_REPLICATED_APP }} | |
| HELM_VERSION: "3.17.3" | |
| KUBECTL_VERSION: "v1.30.0" | |
| jobs: | |
| setup: | |
| runs-on: ubuntu-22.04 | |
| outputs: | |
| branch-name: ${{ steps.vars.outputs.branch-name }} | |
| channel-name: ${{ steps.vars.outputs.channel-name }} | |
| steps: | |
| - name: Set branch and channel variables | |
| id: vars | |
| run: | | |
| BRANCH_NAME="${{ github.head_ref || github.ref_name }}" | |
| CHANNEL_NAME=$(echo "$BRANCH_NAME" | tr '[:upper:]' '[:lower:]') | |
| echo "branch-name=$BRANCH_NAME" >> $GITHUB_OUTPUT | |
| echo "channel-name=$CHANNEL_NAME" >> $GITHUB_OUTPUT | |
| echo "Branch: $BRANCH_NAME, Channel: $CHANNEL_NAME" | |
| build-release: | |
| runs-on: ubuntu-22.04 | |
| needs: setup | |
| defaults: | |
| run: | |
| working-directory: ${{ env.APP_DIR }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Cache Helm dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| applications/wg-easy/charts/*/charts | |
| applications/wg-easy/Chart.lock | |
| key: helm-deps-${{ hashFiles('applications/wg-easy/charts/*/Chart.yaml') }} | |
| - name: Setup tools | |
| uses: ./.github/actions/setup-tools | |
| with: | |
| helm-version: ${{ env.HELM_VERSION }} | |
| kubectl-version: ${{ env.KUBECTL_VERSION }} | |
| install-kubectl: 'true' | |
| install-preflight: 'true' | |
| - name: Update dependencies | |
| run: task dependencies-update | |
| timeout-minutes: 10 | |
| - name: Prepare release | |
| run: task release-prepare | |
| timeout-minutes: 10 | |
| - name: Verify release directory contents | |
| run: | | |
| echo "Checking release directory contents:" | |
| ls -la release/ | |
| echo "Verifying required files exist:" | |
| test -f release/application.yaml | |
| test -f release/config.yaml | |
| test -f release/cluster.yaml | |
| find release/ -name "*.tgz" | wc -l | grep -v "^0$" | |
| - name: Upload release artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wg-easy-release-${{ github.run_number }} | |
| path: ${{ env.APP_DIR }}/release/ | |
| retention-days: 7 | |
| lint-and-validate: | |
| runs-on: ubuntu-22.04 | |
| needs: setup | |
| defaults: | |
| run: | |
| working-directory: ${{ env.APP_DIR }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Cache Helm dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| applications/wg-easy/charts/*/charts | |
| applications/wg-easy/Chart.lock | |
| key: helm-deps-${{ hashFiles('applications/wg-easy/charts/*/Chart.yaml') }} | |
| - name: Setup tools | |
| uses: ./.github/actions/setup-tools | |
| with: | |
| helm-version: ${{ env.HELM_VERSION }} | |
| - name: Update dependencies | |
| run: task dependencies-update | |
| - name: Lint Helm charts | |
| run: | | |
| for chart_dir in $(find charts/ -maxdepth 2 -name "Chart.yaml" | \ | |
| xargs dirname); do | |
| echo "Linting chart: $chart_dir" | |
| helm lint "$chart_dir" | |
| done | |
| - name: Template Helm charts | |
| run: | | |
| for chart_dir in $(find charts/ -maxdepth 2 -name "Chart.yaml" | \ | |
| xargs dirname); do | |
| echo "Templating chart: $chart_dir" | |
| helm template test-release "$chart_dir" --dry-run | |
| done | |
| - name: Validate Taskfile syntax | |
| run: task --list-all | |
| - name: Validate helmfile template | |
| uses: helmfile/[email protected] | |
| if: hashFiles('helmfile.yaml.gotmpl') != '' | |
| with: | |
| helmfile-args: build | |
| helmfile-workdirectory: ${{ env.APP_DIR }} | |
| env: | |
| REPLICATED_APP: "test-app" | |
| CHANNEL: "unstable" | |
| REPLICATED_LICENSE_ID: "test-license" | |
| TF_EXPOSED_URL: "test.example.com" | |
| replicated-release: | |
| runs-on: ubuntu-22.04 | |
| needs: [setup, build-release] | |
| defaults: | |
| run: | |
| working-directory: ${{ env.APP_DIR }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup tools | |
| uses: ./.github/actions/setup-tools | |
| with: | |
| helm-version: ${{ env.HELM_VERSION }} | |
| kubectl-version: ${{ env.KUBECTL_VERSION }} | |
| install-kubectl: 'true' | |
| - name: Create channel for branch | |
| run: task channel-create RELEASE_CHANNEL="${{ needs.setup.outputs.channel-name }}" | |
| timeout-minutes: 5 | |
| - name: Prepare release | |
| run: task release-prepare | |
| timeout-minutes: 15 | |
| - name: Create release | |
| run: task release-create RELEASE_CHANNEL="${{ needs.setup.outputs.channel-name }}" | |
| timeout-minutes: 15 | |
| create-customer-and-cluster: | |
| runs-on: ubuntu-22.04 | |
| needs: [setup, replicated-release] | |
| defaults: | |
| run: | |
| working-directory: ${{ env.APP_DIR }} | |
| outputs: | |
| customer-license: ${{ steps.license.outputs.customer-license }} | |
| customer-email: ${{ steps.customer.outputs.customer-email }} | |
| skip-customer-registry: ${{ steps.prereqs.outputs.skip-customer-registry }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Check prerequisites | |
| id: prereqs | |
| run: | | |
| echo "Prerequisites check complete" | |
| echo "skip-customer-registry=false" >> $GITHUB_OUTPUT | |
| - name: Setup tools | |
| uses: ./.github/actions/setup-tools | |
| - name: Create customer | |
| id: customer | |
| run: | | |
| # Create customer and derive email from branch name | |
| CUSTOMER_NAME="${{ needs.setup.outputs.branch-name }}" | |
| task customer-create CUSTOMER_NAME="$CUSTOMER_NAME" RELEASE_CHANNEL="${{ needs.setup.outputs.channel-name }}" | |
| # Derive customer email from customer name (branch name) | |
| CUSTOMER_EMAIL="${CUSTOMER_NAME}@example.com" | |
| echo "customer-email=$CUSTOMER_EMAIL" >> $GITHUB_OUTPUT | |
| echo "Customer email: $CUSTOMER_EMAIL" | |
| timeout-minutes: 5 | |
| - name: Create cluster with retry | |
| uses: nick-fields/[email protected] | |
| with: | |
| timeout_minutes: 20 | |
| retry_wait_seconds: 30 | |
| max_attempts: 3 | |
| command: | | |
| cd ${{ env.APP_DIR }} | |
| task cluster-create CLUSTER_NAME="${{ needs.setup.outputs.branch-name }}" | |
| - name: Get customer license ID | |
| id: license | |
| run: | | |
| LICENSE_ID=$(task utils:get-customer-license CUSTOMER_NAME="${{ needs.setup.outputs.branch-name }}" --silent | tail -1) | |
| echo "customer-license=$LICENSE_ID" >> $GITHUB_OUTPUT | |
| echo "::add-mask::$LICENSE_ID" | |
| helm-install-test: | |
| runs-on: ubuntu-22.04 | |
| needs: [setup, create-customer-and-cluster] | |
| defaults: | |
| run: | |
| working-directory: ${{ env.APP_DIR }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup tools | |
| uses: ./.github/actions/setup-tools | |
| with: | |
| helm-version: ${{ env.HELM_VERSION }} | |
| install-helmfile: 'true' | |
| - name: Update dependencies | |
| run: task dependencies-update | |
| - name: Helm registry login | |
| run: | | |
| helm registry login registry.replicated.com --username "${{ needs.create-customer-and-cluster.outputs.customer-license }}" --password "${{ needs.create-customer-and-cluster.outputs.customer-license }}" | |
| timeout-minutes: 5 | |
| - name: Helm install | |
| run: task helm-install | |
| timeout-minutes: 20 | |
| env: | |
| CHANNEL: ${{ needs.setup.outputs.channel-name }} | |
| REPLICATED_LICENSE_ID: ${{ needs.create-customer-and-cluster.outputs.customer-license }} | |
| HELM_ENV: replicated | |
| - name: Upload debug logs | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: debug-logs-${{ github.run_number }} | |
| path: | | |
| /tmp/*.log | |
| ~/.replicated/ | |