diff --git a/.github/workflows/test-aws-init-package.yml b/.github/workflows/test-aws-init-package.yml index f4c4e8d..908f7a0 100644 --- a/.github/workflows/test-aws-init-package.yml +++ b/.github/workflows/test-aws-init-package.yml @@ -1,11 +1,15 @@ name: Test AWS Init Package on: - push: - branches: - - main pull_request: - branches: - - main + paths-ignore: + - "**.md" + - "**.jpg" + - "**.png" + - "**.gif" + - "**.svg" + - "adr/**" + - "docs/**" + - "CODEOWNERS" workflow_dispatch: inputs: diff --git a/.github/workflows/test-pepr-module.yml b/.github/workflows/test-pepr-module.yml new file mode 100644 index 0000000..420a94d --- /dev/null +++ b/.github/workflows/test-pepr-module.yml @@ -0,0 +1,40 @@ +name: Test Pepr Module +on: + pull_request: + paths-ignore: + - "**.md" + - "**.jpg" + - "**.png" + - "**.gif" + - "**.svg" + - "adr/**" + - "docs/**" + - "CODEOWNERS" + +permissions: + contents: read + +# Abort prior jobs in the same workflow / PR +concurrency: + group: pepr-module-${{ github.ref }} + cancel-in-progress: true + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 + + - name: Setup NodeJS + uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 + with: + node-version: 18 + cache: "npm" + cache-dependency-path: "package-lock.json" + + - name: Install Node dependencies + run: npm ci + + - name: Run unit tests for Pepr module + run: make test-module diff --git a/capabilities/lib/utils.test.ts b/capabilities/lib/utils.test.ts index 7680c96..8d9e0d7 100644 --- a/capabilities/lib/utils.test.ts +++ b/capabilities/lib/utils.test.ts @@ -27,6 +27,11 @@ describe("getRepositoryNames", () => { input: "registry1.dso.mil/defenseunicorns/zarf/agent:latest", expected: "defenseunicorns/zarf/agent", }, + { + input: + "defenseunicorns/zarf-game@sha256:f78e442f0f3eb3e9459b5ae6b1a8fda62f8dfe818112e7d130a4e8ae72b3cbff", + expected: "defenseunicorns/zarf-game", + }, ]; testCases.forEach(({ input, expected }) => { diff --git a/capabilities/lib/utils.ts b/capabilities/lib/utils.ts index 51cb17a..2730a12 100644 --- a/capabilities/lib/utils.ts +++ b/capabilities/lib/utils.ts @@ -46,8 +46,10 @@ export function getRepositoryNames(images: string[]): string[] { } const repoNames = images.map((image: string) => { - if (image.includes(":")) { + if (image.includes(":") && !image.includes("@sha256")) { image = image.split(":")[0]; + } else if (image.includes("@sha256")) { + image = image.split("@sha256")[0]; } const firstSlashIndex = image.indexOf("/");