From ff4adfbff10873fa4211695464cfa63b97b413b9 Mon Sep 17 00:00:00 2001 From: Mike Vanhemert Date: Thu, 30 Nov 2023 10:15:46 -0700 Subject: [PATCH] pipelining --- .github/actions/comment/action.yml | 29 ---- .github/actions/e2e/action.yml | 163 ------------------ .github/actions/parse-test/action.yml | 50 ------ .github/actions/save-logs/action.yaml | 18 ++ .github/actions/setup/action.yaml | 30 ++++ .github/workflows/commitlint.yaml | 28 +++ .github/workflows/publish.yml | 91 ---------- .../workflows/pull-request-conditionals.yaml | 30 ++++ .github/workflows/slash-command-dispatch.yml | 16 -- .github/workflows/tag-and-release.yaml | 55 ++++++ .github/workflows/test-command.yml | 96 ----------- .github/workflows/test.yaml | 46 +++++ 12 files changed, 207 insertions(+), 445 deletions(-) delete mode 100644 .github/actions/comment/action.yml delete mode 100644 .github/actions/e2e/action.yml delete mode 100644 .github/actions/parse-test/action.yml create mode 100644 .github/actions/save-logs/action.yaml create mode 100644 .github/actions/setup/action.yaml create mode 100644 .github/workflows/commitlint.yaml delete mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/pull-request-conditionals.yaml delete mode 100644 .github/workflows/slash-command-dispatch.yml create mode 100644 .github/workflows/tag-and-release.yaml delete mode 100644 .github/workflows/test-command.yml create mode 100644 .github/workflows/test.yaml diff --git a/.github/actions/comment/action.yml b/.github/actions/comment/action.yml deleted file mode 100644 index fbc20cbc..00000000 --- a/.github/actions/comment/action.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Update Slash Command Dispatch Comment - -description: Update Slash Command Dispatch comment with the run URL - -inputs: - token: - description: Personal Access Token (PAT) used to update the comment - required: true - -runs: - using: composite - steps: - - name: Create URL to the run output - id: vars - shell: bash -e -o pipefail {0} - run: echo "run-url=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_OUTPUT - - # Will update the comment that triggered the /test comment and add the run-url - - name: Update comment - if: github.event_name == 'repository_dispatch' - uses: peter-evans/create-or-update-comment@v3 - with: - token: ${{ inputs.token }} - repository: ${{ github.event.client_payload.github.payload.repository.full_name }} - comment-id: ${{ github.event.client_payload.github.payload.comment.id }} - body: | - :robot: [View pipeline run][1] - - [1]: ${{ steps.vars.outputs.run-url }} diff --git a/.github/actions/e2e/action.yml b/.github/actions/e2e/action.yml deleted file mode 100644 index 2528188b..00000000 --- a/.github/actions/e2e/action.yml +++ /dev/null @@ -1,163 +0,0 @@ -name: Run E2E Tests - -description: Run E2E Tests - -inputs: - token: - description: Personal Access Token (PAT) used to update the comment - required: true - region: - description: The AWS region to deploy to - required: true - role-to-assume: - description: The AWS IAM Role to assume in the target account - required: true - github-context: - description: The GitHub Status Context to use when updating the status - required: true - aws-availability-zone: - description: The AWS Availability Zone to use - required: true - ghcr-username: - description: The Github container registry username to use - required: true - ghcr-password: - description: The Github container registry password to use - required: true - registry1-username: - description: The Registry1 container registry password to use - required: true - registry1-password: - description: The Registry1 container registry password to use - required: true - -runs: - using: composite - steps: - # Update GitHub status for pending pipeline run - - name: "Update GitHub Status for pending" - if: github.event_name == 'repository_dispatch' - uses: docker://cloudposse/github-status-updater - with: - args: "-action update_state -state pending -ref ${{ env.REPO_SHA }} -repo ${{ env.REPO_NAME }}" - env: - REPO_SHA: ${{ github.event.client_payload.pull_request.head.sha || github.sha }} - REPO_NAME: ${{ github.event.client_payload.github.payload.repository.name || github.event.repository.name }} - GITHUB_TOKEN: ${{ inputs.token }} - GITHUB_CONTEXT: ${{ inputs.github-context }} - GITHUB_DESCRIPTION: "started by @${{ github.event.client_payload.github.actor || github.actor }}" - GITHUB_TARGET_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} - GITHUB_REF: ${{ github.event.client_payload.pull_request.head.ref || github.ref_name }} - GITHUB_OWNER: ${{ github.event.client_payload.github.payload.repository.owner.login || github.repository_owner }} - - - name: Init gopath cache - uses: actions/cache@v3 - with: - path: "${{ github.workspace }}/.cache/go" - key: "gopath|${{ hashFiles('.tool-versions') }}|${{ hashFiles('go.sum') }}" - - - name: Init gobuild cache - uses: actions/cache@v3 - with: - path: "${{ github.workspace }}/.cache/go-build" - key: "gobuild|${{ hashFiles('.tool-versions') }}|${{ hashFiles('go.sum') }}" - - - name: Init zarf cache - uses: actions/cache@v3 - with: - path: "${{ github.workspace }}/.cache/.zarf-cache" - key: "zarf|${{ hashFiles('.tool-versions') }}" - - - name: Init docker cache - id: init-docker-cache - uses: actions/cache@v3 - with: - path: "${{ github.workspace }}/.cache/docker" - key: "docker|${{ hashFiles('.env') }}" - - - name: Docker save build harness - if: steps.init-docker-cache.outputs.cache-hit != 'true' - shell: bash -e -o pipefail {0} - run: | - make docker-save-build-harness - - - name: Load build harness - shell: bash -e -o pipefail {0} - run: | - make docker-load-build-harness - - - name: Get Terraform version from .tool-versions - id: get_tf_version - shell: bash -e -o pipefail {0} - run: echo "tf_version=$(grep 'terraform ' .tool-versions)" >> $GITHUB_OUTPUT - - - name: Configure AWS Credentials for Commercial - uses: aws-actions/configure-aws-credentials@v2 - with: - role-to-assume: ${{ inputs.role-to-assume }} - role-session-name: ${{ github.event.client_payload.pull_request.head.sha || github.sha }} - aws-region: ${{ inputs.region }} - # 21600 seconds == 6 hours - role-duration-seconds: 21600 - - - name: "Run E2E tests" - shell: bash -e -o pipefail {0} - env: - AWS_AVAILABILITY_ZONE: ${{ inputs.aws-availability-zone }} - AWS_DEFAULT_REGION: us-east-2 - REGISTRY1_USERNAME: ${{ inputs.registry1-username }} - REGISTRY1_PASSWORD: ${{ inputs.registry1-password }} - GHCR_USERNAME: ${{ inputs.ghcr-username }} - GHCR_PASSWORD: ${{ inputs.ghcr-password }} - REPO_URL: https://github.com/${{ github.repository }}.git - GIT_BRANCH: ${{ github.event.client_payload.pull_request.head.ref || github.ref_name }} - run: | - make test fix-cache-permissions - - # Update GitHub status for successful pipeline run - - name: "Update GitHub Status for success" - if: ${{ success() && github.event_name == 'repository_dispatch' }} - uses: docker://cloudposse/github-status-updater - with: - args: "-action update_state -state success -ref ${{ env.REPO_SHA }} -repo ${{ env.REPO_NAME }}" - env: - REPO_SHA: ${{ github.event.client_payload.pull_request.head.sha || github.sha }} - REPO_NAME: ${{ github.event.client_payload.github.payload.repository.name || github.event.repository.name }} - GITHUB_TOKEN: ${{ inputs.token }} - GITHUB_CONTEXT: ${{ inputs.github-context }} - GITHUB_DESCRIPTION: "run passed" - GITHUB_TARGET_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} - GITHUB_REF: ${{ github.event.client_payload.pull_request.head.ref || github.ref_name }} - GITHUB_OWNER: ${{ github.event.client_payload.github.payload.repository.owner.login || github.repository_owner }} - - # Update GitHub status for failing pipeline run - - name: "Update GitHub Status for failure" - if: ${{ failure() && github.event_name == 'repository_dispatch' }} - uses: docker://cloudposse/github-status-updater - with: - args: "-action update_state -state failure -ref ${{ env.REPO_SHA }} -repo ${{ env.REPO_NAME }}" - env: - REPO_SHA: ${{ github.event.client_payload.pull_request.head.sha || github.sha }} - REPO_NAME: ${{ github.event.client_payload.github.payload.repository.name || github.event.repository.name }} - GITHUB_TOKEN: ${{ inputs.token }} - GITHUB_CONTEXT: ${{ inputs.github-context }} - GITHUB_DESCRIPTION: "run failed" - GITHUB_TARGET_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} - GITHUB_REF: ${{ github.event.client_payload.pull_request.head.ref || github.ref_name }} - GITHUB_OWNER: ${{ github.event.client_payload.github.payload.repository.owner.login || github.repository_owner }} - - # Update GitHub status for cancelled pipeline run - - name: "Update GitHub Status for cancelled" - if: ${{ cancelled() && github.event_name == 'repository_dispatch' }} - uses: docker://cloudposse/github-status-updater - with: - args: "-action update_state -state error -ref ${{ env.REPO_SHA }} -repo ${{ env.REPO_NAME }}" - env: - REPO_SHA: ${{ github.event.client_payload.pull_request.head.sha || github.sha }} - REPO_NAME: ${{ github.event.client_payload.github.payload.repository.name || github.event.repository.name }} - GITHUB_TOKEN: ${{ inputs.token }} - GITHUB_CONTEXT: ${{ inputs.github-context }} - GITHUB_DESCRIPTION: "run cancelled" - GITHUB_TARGET_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} - GITHUB_REF: ${{ github.event.client_payload.pull_request.head.ref || github.ref_name }} - GITHUB_OWNER: ${{ github.event.client_payload.github.payload.repository.owner.login || github.repository_owner }} diff --git a/.github/actions/parse-test/action.yml b/.github/actions/parse-test/action.yml deleted file mode 100644 index 50ac6b33..00000000 --- a/.github/actions/parse-test/action.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Parse Slash Command Dispatch (/test) - -description: Parse Slash Command Dispatch (/test) - -outputs: - run-ping: - description: Will be 'true' if the 'ping' job should run - value: ${{ steps.parse.outputs.ping }} - run-e2e: - description: Will be 'true' if the 'e2e' job should run - value: ${{ steps.parse.outputs.e2e }} - -runs: - using: composite - steps: - - name: Parse Args - id: parse - env: - DEBUG: ${{ toJSON(github.event.client_payload.slash_command) }} - ARGS_V1: ${{ github.event.client_payload.slash_command.arg1 }} - ARGS_V2: ${{ github.event.client_payload.slash_command.args.unnamed.all }} - EVENT_NAME: ${{ github.event_name }} - shell: bash -e -o pipefail {0} - run: | - ARGS="${ARGS_V1}${ARGS_V2}" - # set ARGS to "all" if EVENT_NAME is "push" - if [[ "${EVENT_NAME}" == "push" ]]; then - ARGS="all" - fi - printf "Event name is %s\n" "$EVENT_NAME" - printf "Args are %s\n" "$ARGS" - printf "\n\nslash_command is %s\n\n" "$DEBUG" - COMMANDS=(PING E2E) #all options here - if printf "%s" "${ARGS^^}" | grep -qE '\bALL\b'; then - # "all" explicitly does not include "ping" - for cmd in "${COMMANDS[@]}"; do - [[ $cmd == "PING" ]] && ! { printf "%s" "${ARGS^^}" | grep -qE '\bPING\b'; } && continue - printf -v "$cmd" "true" - done - else - for cmd in "${COMMANDS[@]}"; do - if printf "%s" "${ARGS^^}" | grep -qE "\b${cmd}\b"; then - printf -v "$cmd" "true" - fi - done - fi - for out in "${COMMANDS[@]}"; do - printf "%s=%s\n" "${out,,}" "${!out:-false}" >> $GITHUB_OUTPUT - printf "%s=%s\n" "${out,,}" "${!out:-false}" - done diff --git a/.github/actions/save-logs/action.yaml b/.github/actions/save-logs/action.yaml new file mode 100644 index 00000000..fbb3bfce --- /dev/null +++ b/.github/actions/save-logs/action.yaml @@ -0,0 +1,18 @@ +name: save-logs +description: "Save debug logs" + +runs: + using: composite + steps: + - name: Fix log permissions + run: | + sudo chown $USER /tmp/zarf-*.log || echo "" + sudo chown $USER /tmp/uds-*.log || echo "" + shell: bash + + - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + with: + name: debug-log + path: | + /tmp/zarf-*.log + /tmp/uds-*.log diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml new file mode 100644 index 00000000..beb43105 --- /dev/null +++ b/.github/actions/setup/action.yaml @@ -0,0 +1,30 @@ +# action.yml +name: "Setup Environment" +description: "UDS Environment Setup" + +runs: + using: "composite" + steps: + - name: Install Zarf + uses: defenseunicorns/setup-zarf@main + with: + # renovate: datasource=github-tags depName=defenseunicorns/zarf versioning=semver + version: v0.31.1 + download-init-package: true + + - name: Use Node.js latest + uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 + with: + node-version: 20 + + - name: Install k3d + shell: bash + run: curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=v5.6.0 bash + + - name: Set up Homebrew + uses: Homebrew/actions/setup-homebrew@master + + - name: Install UDS CLI + shell: bash + # renovate: datasource=github-tags depName=defenseunicorns/uds-cli versioning=semver + run: brew install defenseunicorns/tap/uds@0.3.1 diff --git a/.github/workflows/commitlint.yaml b/.github/workflows/commitlint.yaml new file mode 100644 index 00000000..24495034 --- /dev/null +++ b/.github/workflows/commitlint.yaml @@ -0,0 +1,28 @@ +name: Metadata + +on: + pull_request: + branches: [main] + types: [opened, edited, synchronize] + +jobs: + title_check: + runs-on: ubuntu-latest + name: Validate PR Title + permissions: + pull-requests: read + + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 + + - name: Install commitlint + run: npm install --save-dev @commitlint/{config-conventional,cli} + + - name: Lint PR title + run: echo "${{ github.event.pull_request.title }}" | npx commitlint diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 5903601c..00000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,91 +0,0 @@ -name: build-and-publish - -concurrency: - cancel-in-progress: true - group: build-and-publish - -on: - push: - branches: [ "main" ] - workflow_dispatch: - schedule: - - cron: '0 0 * * *' - -jobs: - build-and-publish-package: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Init zarf cache - uses: actions/cache@v3 - with: - path: "~/.zarf-cache" - key: zarf-cache - - - name: Free GH runner build space - run: | - df -h - sudo rm -rf /usr/share/dotnet - sudo rm -rf /usr/local/lib/android - sudo rm -rf /opt/ghc - sudo rm -rf /opt/hostedtoolcache/CodeQL - sudo docker image prune --all --force - df -h - - - name: Install zarf - uses: supplypike/setup-bin@v3 - with: - # renovate: zarf-uri datasource=github-tags depName=defenseunicorns/zarf - uri: 'https://github.com/defenseunicorns/zarf/releases/download/v0.29.1/zarf_v0.29.1_Linux_amd64' - name: 'zarf' - # renovate: datasource=github-tags depName=defenseunicorns/zarf versioning=semver - version: 'v0.29.1' - - - name: Login to GHCR - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Login to registry1 - uses: docker/login-action@v2 - with: - registry: registry1.dso.mil - username: ${{ secrets.REGISTRY1_USERNAME }} - password: ${{ secrets.REGISTRY1_PASSWORD }} - - #### - # Build and publish dependency packages to use in a dev UDS Bundle - #### - - name: Build and publish dev-dependency gitlab-postgres package - run: cd utils/pkg-deps/gitlab/postgres && zarf package create --confirm --no-progress --output oci://ghcr.io/defenseunicorns/uds-capability/gitlab/dev-dependency - - - name: Build and publish dev-dependency gitlab-redis package - run: cd utils/pkg-deps/gitlab/redis && zarf package create --confirm --no-progress --output oci://ghcr.io/defenseunicorns/uds-capability/gitlab/dev-dependency - - - name: Build and publish dev-dependency gitlab-minio package - run: cd utils/pkg-deps/gitlab/minio && zarf package create --confirm --no-progress --output oci://ghcr.io/defenseunicorns/uds-capability/gitlab/dev-dependency - - # - name: Publish dev-dependency gitlab-postgres package - # run: cd utils/pkg-deps/gitlab/postgres && zarf package publish zarf-package-gitlab-postgres-amd64*.tar.zst oci://ghcr.io/defenseunicorns/uds-capability/gitlab/dev-dependency --no-progress - - # - name: Publish dev-dependency gitlab-redis package - # run: cd utils/pkg-deps/gitlab/redis && zarf package publish zarf-package-gitlab-redis-amd64*.tar.zst oci://ghcr.io/defenseunicorns/uds-capability/gitlab/dev-dependency --no-progress - - # - name: Publish dev-dependency gitlab-minio package - # run: cd utils/pkg-deps/gitlab/minio && zarf package publish zarf-package-gitlab-minio-amd64*.tar.zst oci://ghcr.io/defenseunicorns/uds-capability/gitlab/dev-dependency --no-progress - - #### - # Build and publish capability package and skeleton - #### - - name: Build and publish gitlab package - run: zarf package create --confirm --no-progress --output oci://ghcr.io/defenseunicorns/uds-capability - - # - name: Publish gitlab package - # run: zarf package publish zarf-package-gitlab-amd64-*.tar.zst oci://ghcr.io/defenseunicorns/uds-capability --no-progress - - - name: Publish gitlab skeleton - run: zarf package publish . oci://ghcr.io/defenseunicorns/uds-capability --no-progress diff --git a/.github/workflows/pull-request-conditionals.yaml b/.github/workflows/pull-request-conditionals.yaml new file mode 100644 index 00000000..564d821b --- /dev/null +++ b/.github/workflows/pull-request-conditionals.yaml @@ -0,0 +1,30 @@ +name: Setup + +# This workflow is triggered on pull requests to the main branch. +on: + pull_request: + paths: + - ".github/**" + - "bundle/**" + - "values/**" + - "tasks/**" + - "tests/**" + - "tasks.yaml" + - "zarf.yaml" + +# Permissions for the GITHUB_TOKEN used by the workflow. +permissions: + id-token: write # Needed for OIDC-related operations. + contents: read # Allows reading the content of the repository. + pull-requests: read # Allows reading pull request metadata. + +# Default settings for all run commands in the workflow jobs. +defaults: + run: + shell: bash -e -o pipefail {0} # Ensures that scripts fail on error and pipefail is set. + +jobs: + run-test: + name: Test + uses: ./.githug/workflows/test.yaml + secrets: inherit diff --git a/.github/workflows/slash-command-dispatch.yml b/.github/workflows/slash-command-dispatch.yml deleted file mode 100644 index 30533d77..00000000 --- a/.github/workflows/slash-command-dispatch.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Slash Command Dispatch -on: - issue_comment: - types: [created] -jobs: - slashCommandDispatch: - if: github.event.issue.pull_request && contains(github.event.comment.body, '/test') - runs-on: ubuntu-latest - steps: - - name: Slash Command Dispatch - uses: peter-evans/slash-command-dispatch@v3 - with: - token: ${{ secrets.PAT }} - commands: test - permission: write - issue-type: pull-request diff --git a/.github/workflows/tag-and-release.yaml b/.github/workflows/tag-and-release.yaml new file mode 100644 index 00000000..2920289e --- /dev/null +++ b/.github/workflows/tag-and-release.yaml @@ -0,0 +1,55 @@ +# name: Publish UDS Core + +# on: +# push: +# branches: +# - main + +# jobs: +# tag-new-version: +# name: Tag New Version +# permissions: write-all +# runs-on: ubuntu-latest +# outputs: +# release_created: ${{ steps.release-flag.outputs.release_created }} +# steps: +# - name: Create release tag +# id: tag +# uses: google-github-actions/release-please-action@v3 +# with: +# command: manifest # use configs in release-please-config.json +# - id: release-flag +# run: echo "release_created=${{ steps.tag.outputs.release_created || false }}" >> $GITHUB_OUTPUT + +# publish-uds-core: +# needs: tag-new-version +# if: ${{ needs.tag-new-version.outputs.release_created == 'true'}} +# runs-on: ubuntu-latest +# name: Publish packages + +# permissions: +# contents: read +# packages: write + +# steps: +# - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + +# - name: Environment setup +# uses: ./.github/actions/setup + +# - name: Login to GHCR +# uses: docker/login-action@v3 +# with: +# registry: ghcr.io +# username: dummy +# password: ${{ secrets.GITHUB_TOKEN }} + +# - name: Publish UDS Zarf Package +# run: uds run -f tasks/publish.yaml packages + +# - name: Publish UDS Bundles +# run: uds run -f tasks/publish.yaml bundles + +# - name: Save logs +# if: always() +# uses: ./.github/actions/save-logs diff --git a/.github/workflows/test-command.yml b/.github/workflows/test-command.yml deleted file mode 100644 index e7561df9..00000000 --- a/.github/workflows/test-command.yml +++ /dev/null @@ -1,96 +0,0 @@ -# Attribution for a bunch of this goes to CloudPosse -# https://github.com/cloudposse/actions/blob/master/.github/workflows/test-command.yml - -name: test -on: - repository_dispatch: - types: [test-command] - push: - branches: - - main - -permissions: - id-token: write - contents: read - -defaults: - run: - # We need -e -o pipefail for consistency with GitHub Actions' default behavior - shell: bash -e -o pipefail {0} - -jobs: - # Parse the command so we can decide which tests to run. Examples: "/test all", "/test validate", "/test e2e" - # We can do as many of these as we want to get as granular as we want. - parse: - runs-on: ubuntu-latest - outputs: - run-ping: ${{ steps.parse.outputs.run-ping }} - run-e2e: ${{ steps.parse.outputs.run-e2e }} - steps: - - name: Checkout Repo - uses: actions/checkout@v3 - with: - token: ${{ secrets.PAT }} - repository: ${{ github.event.client_payload.pull_request.head.repo.full_name || github.repository }} - ref: ${{ github.event.client_payload.pull_request.head.ref || github.ref_name }} - - name: Parse Args - id: parse - uses: ./.github/actions/parse-test - - # Update the comment that triggered the /test command to show the run url - comment: - if: github.event_name == 'repository_dispatch' - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v3 - with: - token: ${{ secrets.PAT }} - repository: ${{ github.event.client_payload.pull_request.head.repo.full_name || github.repository }} - ref: ${{ github.event.client_payload.pull_request.head.ref || github.ref_name }} - - name: Update Comment - uses: ./.github/actions/comment - with: - token: ${{ secrets.PAT }} - - # Do a simple ping/pong status update to validate things are working - ping: - runs-on: ubuntu-latest - needs: parse - if: needs.parse.outputs.run-ping == 'true' - steps: - - name: Checkout Repo - uses: actions/checkout@v3 - with: - token: ${{ secrets.PAT }} - repository: ${{ github.event.client_payload.pull_request.head.repo.full_name || github.repository }} - ref: ${{ github.event.client_payload.pull_request.head.ref || github.ref_name }} - - name: Ping Test - uses: ./.github/actions/ping - with: - token: ${{ secrets.PAT }} - - # Run the E2E tests - e2e: - runs-on: ubuntu-latest - needs: parse - if: needs.parse.outputs.run-e2e == 'true' - steps: - - name: Checkout Repo - uses: actions/checkout@v3 - with: - token: ${{ secrets.PAT }} - repository: ${{ github.event.client_payload.pull_request.head.repo.full_name || github.repository }} - ref: ${{ github.event.client_payload.pull_request.head.ref || github.ref_name }} - - name: Run E2E Tests - uses: ./.github/actions/e2e - with: - token: ${{ secrets.PAT }} - role-to-assume: ${{ secrets.AWS_COMMERCIAL_ROLE_TO_ASSUME }} - region: ${{ vars.AWS_REGION }} - github-context: "test / e2e (${{github.event_name}})" - aws-availability-zone: ${{ vars.AWS_AVAILABILITY_ZONE }} - ghcr-username: ${{ github.actor }} - ghcr-password: ${{ secrets.GITHUB_TOKEN }} - registry1-username: ${{ secrets.REGISTRY1_USERNAME }} - registry1-password: ${{ secrets.REGISTRY1_PASSWORD }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 00000000..e62b7781 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,46 @@ +name: Test package + +on: + # Manual trigger + workflow_dispatch: + + # Triggered by pull-request-conditionals.yaml + workflow_call: + +# Abort prior jobs in the same workflow / PR +concurrency: + group: test-${{ github.ref }}-${{ inputs.package }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + test: + runs-on: "ubuntu" #"uds-ubuntu-big-boy-8-core" + timeout-minutes: 15 + name: Test + + steps: + - name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Environment setup + uses: ./.github/actions/setup + + - name: Setup cluster + run: uds run setup-cluster + + - name: Create test bundle + run: uds run create-test-bundle + + - name: Test package + run: uds run test-package + + - name: Cleanup + if: always() + run: uds run cleanup + + - name: Save logs + if: always() + uses: ./.github/actions/save-logs