From 4af9d3a210f4776909db5f3d611840c57a0f44e6 Mon Sep 17 00:00:00 2001 From: Wayne Starr Date: Thu, 20 Jun 2024 16:07:45 -0600 Subject: [PATCH] chore: cache playwright and add tests to amd64 release (#155) ## Description This splits the playwright install step and adds caching to speed up CI tests ## Related Issue Fixes #139 ## Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [X] Other (security config, docs update, etc) ## Checklist before merging - [X] Test, docs, adr added or updated as needed - [X] [Contributor Guide Steps](https://github.com/defenseunicorns/uds-package-gitlab/blob/main/CONTRIBUTING.md#developer-workflow) followed --- .github/workflows/commitlint.yaml | 2 +- .github/workflows/lint.yaml | 6 +-- .github/workflows/tag-and-release.yaml | 39 +++++++++++++---- .github/workflows/test.yaml | 13 ++++-- README.md | 3 ++ tasks.yaml | 20 ++++----- tasks/publish.yaml | 58 +++++++++++--------------- tasks/test.yaml | 18 ++++++-- tests/auth.setup.ts | 6 +-- 9 files changed, 97 insertions(+), 68 deletions(-) diff --git a/.github/workflows/commitlint.yaml b/.github/workflows/commitlint.yaml index b67bbd17..b49b58f1 100644 --- a/.github/workflows/commitlint.yaml +++ b/.github/workflows/commitlint.yaml @@ -12,4 +12,4 @@ on: jobs: validate: name: Validate - uses: defenseunicorns/uds-common/.github/workflows/commitlint.yaml@11e591f2ec7d158923d973c85097ce28a5f55db4 # v0.4.5 + uses: defenseunicorns/uds-common/.github/workflows/commitlint.yaml@0901c37366f37fea586768c79708e14e964e714e # v0.6.1 diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index f3be6a66..bbbfcd14 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -20,7 +20,7 @@ jobs: fetch-depth: 0 - name: Environment setup - uses: defenseunicorns/uds-common/.github/actions/setup@11e591f2ec7d158923d973c85097ce28a5f55db4 # v0.4.5 + uses: defenseunicorns/uds-common/.github/actions/setup@0901c37366f37fea586768c79708e14e964e714e # v0.6.1 with: registry1Username: ${{ secrets.IRON_BANK_ROBOT_USERNAME }} registry1Password: ${{ secrets.IRON_BANK_ROBOT_PASSWORD }} @@ -28,8 +28,8 @@ jobs: - name: Install lint deps run: | - uds run lint:deps + uds run lint:deps --no-progress - name: Lint the repository run: | - uds run lint:yaml + uds run lint:yaml --no-progress diff --git a/.github/workflows/tag-and-release.yaml b/.github/workflows/tag-and-release.yaml index 594af59b..b2e5eb4b 100644 --- a/.github/workflows/tag-and-release.yaml +++ b/.github/workflows/tag-and-release.yaml @@ -1,4 +1,4 @@ -name: Publish UDS Package Gitlab +name: Publish UDS Package GitLab on: push: @@ -22,11 +22,17 @@ jobs: publish-package: needs: tag-new-version if: ${{ needs.tag-new-version.outputs.release_created == 'true' }} - runs-on: ubuntu-latest - name: Publish ${{ matrix.flavor }} + # TODO: (@WSTARR) since we don't run the tests on arm currently we don't need to use the 8 core + runs-on: ${{ matrix.architecture == 'arm64' && 'uds-ubuntu-arm64-4-core' || 'uds-ubuntu-big-boy-8-core' }} + name: Publish ${{ matrix.flavor }} ${{ matrix.architecture }} + timeout-minutes: 40 strategy: matrix: flavor: [upstream, registry1] + architecture: [amd64, arm64] + exclude: + - flavor: registry1 + architecture: arm64 permissions: contents: read @@ -36,21 +42,38 @@ jobs: - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 - name: Environment setup - uses: defenseunicorns/uds-common/.github/actions/setup@11e591f2ec7d158923d973c85097ce28a5f55db4 # v0.4.5 + uses: defenseunicorns/uds-common/.github/actions/setup@0901c37366f37fea586768c79708e14e964e714e # v0.6.1 with: registry1Username: ${{ secrets.IRON_BANK_ROBOT_USERNAME }} registry1Password: ${{ secrets.IRON_BANK_ROBOT_PASSWORD }} ghToken: ${{ secrets.GITHUB_TOKEN }} + - name: Playwright setup + uses: defenseunicorns/uds-common/.github/actions/playwright@0901c37366f37fea586768c79708e14e964e714e # v0.6.1 + + - name: Build Package + run: uds run -f tasks/publish.yaml build-package --set FLAVOR=${{ matrix.flavor }} + + - name: Build Bundle + run: uds run -f tasks/publish.yaml build-test-bundle --set FLAVOR=${{ matrix.flavor }} + + - name: Test Package + if: ${{ runner.arch != 'ARM64' }} + run: uds run -f tasks/publish.yaml test-package --set FLAVOR=${{ matrix.flavor }} + - name: Publish Package - run: uds run -f tasks/publish.yaml package --set FLAVOR=${{ matrix.flavor }} + run: uds run -f tasks/publish.yaml publish-package --set FLAVOR=${{ matrix.flavor }} - name: Publish Bundle if: ${{ matrix.flavor == 'upstream' }} - run: uds run -f tasks/publish.yaml test-bundle --set FLAVOR=${{ matrix.flavor }} + run: uds run -f tasks/publish.yaml publish-test-bundle --set FLAVOR=${{ matrix.flavor }} + + - name: Debug Output + if: ${{ always() }} + uses: defenseunicorns/uds-common/.github/actions/debug-output@0901c37366f37fea586768c79708e14e964e714e # v0.6.1 - name: Save logs if: always() - uses: defenseunicorns/uds-common/.github/actions/save-logs@11e591f2ec7d158923d973c85097ce28a5f55db4 # v0.4.5 + uses: defenseunicorns/uds-common/.github/actions/save-logs@0901c37366f37fea586768c79708e14e964e714e # v0.6.1 with: - suffix: '${{ matrix.flavor }}-${{ github.run_id }}-${{ github.run_attempt }}' + suffix: '${{ matrix.flavor }}-${{ matrix.architecture }}-${{ github.run_id }}-${{ github.run_attempt }}' diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 56b452d6..74bcf05a 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -46,21 +46,28 @@ jobs: uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 - name: Environment setup - uses: defenseunicorns/uds-common/.github/actions/setup@11e591f2ec7d158923d973c85097ce28a5f55db4 # v0.4.5 + uses: defenseunicorns/uds-common/.github/actions/setup@0901c37366f37fea586768c79708e14e964e714e # v0.6.1 with: registry1Username: ${{ secrets.IRON_BANK_ROBOT_USERNAME }} registry1Password: ${{ secrets.IRON_BANK_ROBOT_PASSWORD }} ghToken: ${{ secrets.GITHUB_TOKEN }} + - name: Playwright setup + uses: defenseunicorns/uds-common/.github/actions/playwright@0901c37366f37fea586768c79708e14e964e714e # v0.6.1 + - name: Test - uses: defenseunicorns/uds-common/.github/actions/test@11e591f2ec7d158923d973c85097ce28a5f55db4 # v0.4.5 + uses: defenseunicorns/uds-common/.github/actions/test@0901c37366f37fea586768c79708e14e964e714e # v0.6.1 with: flavor: ${{ matrix.flavor }} type: ${{ matrix.type }} + - name: Debug Output + if: ${{ always() }} + uses: defenseunicorns/uds-common/.github/actions/debug-output@0901c37366f37fea586768c79708e14e964e714e # v0.6.1 + - name: Save logs if: always() - uses: defenseunicorns/uds-common/.github/actions/save-logs@11e591f2ec7d158923d973c85097ce28a5f55db4 # v0.4.5 + uses: defenseunicorns/uds-common/.github/actions/save-logs@0901c37366f37fea586768c79708e14e964e714e # v0.6.1 with: suffix: ${{ matrix.type }}-${{ matrix.flavor }}-${{ github.run_id }}-${{ github.run_attempt }} diff --git a/README.md b/README.md index a51f2a6a..156c985a 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,9 @@ This package is designed for use as part of a [UDS Software Factory](https://github.com/defenseunicorns/uds-software-factory) bundle deployed on [UDS Core](https://github.com/defenseunicorns/uds-core), and is based on the Bigbang [GitLab](https://repo1.dso.mil/big-bang/product/packages/gitlab) chart. +> [!IMPORTANT] +> The `arm64` package includes `amd64` images due to lack of availability of `arm64` images from upstream projects at this time. This means you can deploy the `arm64` package on an `arm64` kubernetes cluster, but some of the images contained in the package will require emulation (e.g., qemu or rosetta) to run properly. + ## Pre-requisites The GitLab Package expects to be deployed on top of [UDS Core](https://github.com/defenseunicorns/uds-core) with the dependencies listed below being configured prior to deployment. diff --git a/tasks.yaml b/tasks.yaml index 0941fb66..6696bd60 100644 --- a/tasks.yaml +++ b/tasks.yaml @@ -2,11 +2,11 @@ includes: - cleanup: ./tasks/cleanup.yaml - dependencies: ./tasks/dependencies.yaml - test: ./tasks/test.yaml - - create: https://raw.githubusercontent.com/defenseunicorns/uds-common/v0.4.5/tasks/create.yaml - - lint: https://raw.githubusercontent.com/defenseunicorns/uds-common/v0.4.5/tasks/lint.yaml - - pull: https://raw.githubusercontent.com/defenseunicorns/uds-common/v0.4.5/tasks/pull.yaml - - deploy: https://raw.githubusercontent.com/defenseunicorns/uds-common/v0.4.5/tasks/deploy.yaml - - setup: https://raw.githubusercontent.com/defenseunicorns/uds-common/v0.4.5/tasks/setup.yaml + - create: https://raw.githubusercontent.com/defenseunicorns/uds-common/v0.6.1/tasks/create.yaml + - lint: https://raw.githubusercontent.com/defenseunicorns/uds-common/v0.6.1/tasks/lint.yaml + - pull: https://raw.githubusercontent.com/defenseunicorns/uds-common/v0.6.1/tasks/pull.yaml + - deploy: https://raw.githubusercontent.com/defenseunicorns/uds-common/v0.6.1/tasks/deploy.yaml + - setup: https://raw.githubusercontent.com/defenseunicorns/uds-common/v0.6.1/tasks/setup.yaml tasks: - name: default @@ -54,10 +54,7 @@ tasks: - task: setup:k3d-test-cluster - task: deploy:test-bundle - task: setup:create-doug-user - - task: test:health-check - - task: test:ingress - - task: test:ui - - task: test:git + - task: test:all - name: test-upgrade description: Test an upgrade from the latest released package to the current branch @@ -68,7 +65,4 @@ tasks: - task: create-gl-test-bundle - task: deploy:test-bundle - task: setup:create-doug-user - - task: test:health-check - - task: test:ingress - - task: test:ui - - task: test:git + - task: test:all diff --git a/tasks/publish.yaml b/tasks/publish.yaml index 3dac7b9b..de861f3d 100644 --- a/tasks/publish.yaml +++ b/tasks/publish.yaml @@ -1,22 +1,34 @@ includes: - dependencies: ./dependencies.yaml - - create: https://raw.githubusercontent.com/defenseunicorns/uds-common/v0.4.5/tasks/create.yaml - - publish: https://raw.githubusercontent.com/defenseunicorns/uds-common/v0.4.5/tasks/publish.yaml + - test: ./test.yaml + - create: https://raw.githubusercontent.com/defenseunicorns/uds-common/v0.6.1/tasks/create.yaml + - deploy: https://raw.githubusercontent.com/defenseunicorns/uds-common/v0.6.1/tasks/deploy.yaml + - publish: https://raw.githubusercontent.com/defenseunicorns/uds-common/v0.6.1/tasks/publish.yaml + - setup: https://raw.githubusercontent.com/defenseunicorns/uds-common/v0.6.1/tasks/setup.yaml tasks: - - name: package - description: Build and publish the packages + - name: build-package + description: Build package actions: - - description: Create the AMD64 package - task: create:package - with: - architecture: amd64 + - task: create:package - - description: Create the ARM64 package - task: create:package - with: - architecture: arm64 + - name: build-test-bundle + description: Build the test bundle + actions: + - task: dependencies:create + - task: create:test-bundle + - name: test-package + description: Test the package + actions: + - task: setup:k3d-test-cluster + - task: deploy:test-bundle + - task: setup:create-doug-user + - task: test:all + + - name: publish-package + description: Build and publish the packages + actions: - description: Publish the packages task: publish:package with: @@ -24,29 +36,9 @@ tasks: version: "17.0.1-uds.1" # x-release-please-end - - name: test-bundle + - name: publish-test-bundle description: Build and publish the test bundles actions: - - description: Create the ARM64 deps package - task: dependencies:create - with: - architecture: amd64 - - - description: Create the ARM64 deps package - task: dependencies:create - with: - architecture: arm64 - - - description: Create the AMD64 bundle - task: create:test-bundle - with: - architecture: amd64 - - - description: Create the ARM64 bundle - task: create:test-bundle - with: - architecture: arm64 - - description: Publish the bundles task: publish:test-bundle with: diff --git a/tasks/test.yaml b/tasks/test.yaml index 2d8dd306..ae6e01ee 100644 --- a/tasks/test.yaml +++ b/tasks/test.yaml @@ -3,6 +3,13 @@ variables: default: glpat-NO_DEFAULT_VALUE tasks: + - name: all + actions: + - task: test:health-check + - task: test:ingress + - task: test:ui + - task: test:git + - name: health-check actions: - description: GitLab Exporter Health Check @@ -112,10 +119,6 @@ tasks: - name: ui description: GitLab UI Checks actions: - - cmd: npm ci - dir: tests - - cmd: npx playwright install --with-deps - dir: tests - cmd: npx playwright test dir: tests @@ -149,3 +152,10 @@ tasks: actions: - description: Get the root password for GitLab (useful for local dev) cmd: ./uds zarf tools kubectl get secret -n gitlab gitlab-gitlab-initial-root-password -o jsonpath={.data.password} | base64 -d + + - name: install-playwright-deps + actions: + - cmd: npm ci + dir: tests + - cmd: npx playwright install --with-deps + dir: tests diff --git a/tests/auth.setup.ts b/tests/auth.setup.ts index 03899310..44b402c0 100644 --- a/tests/auth.setup.ts +++ b/tests/auth.setup.ts @@ -2,13 +2,13 @@ import { test as setup, expect } from '@playwright/test'; import { authFile } from './playwright.config'; setup('authenticate', async ({ page, context }) => { - await page.goto('/'); + await page.goto('/dashboard/projects'); await page.getByLabel('Username or email').fill('doug'); await page.getByLabel('Password').fill('unicorn123!@#'); await page.getByRole('button', { name: "Log In" }).click(); - await page.waitForURL('/'); // successful redirect + await page.waitForURL('/dashboard/projects'); // successful redirect // ensure auth cookies were set const cookies = await context.cookies(); @@ -22,5 +22,5 @@ setup('authenticate', async ({ page, context }) => { await page.context().storageState({ path: authFile }); - await expect(page).toHaveURL('/'); + await expect(page).toHaveURL('/dashboard/projects'); })