Skip to content

Commit 6eadf13

Browse files
committed
Add integration test for using registries-auth-tokens
1 parent 0e98efa commit 6eadf13

File tree

3 files changed

+149
-0
lines changed

3 files changed

+149
-0
lines changed

Diff for: .github/workflows/__init-with-registries.yml

+95
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: pr-checks/checks/init-with-registries.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# A test for running the init command with a registries block.
2+
# This test does _not_ validate that the action can authenticate
3+
# against multiple registries. All it does is validate that the
4+
# basic mechanics of multi-registry auth is working.
5+
name: "Packaging: Download using registries"
6+
description: "Checks that specifying a registries block and associated auth works as expected"
7+
versions: ["latest", "cached", "nightly-latest"] # This feature is not compatible with old CLIs
8+
9+
steps:
10+
- name: Init with registries-auth-tokens
11+
uses: ./../action/init
12+
with:
13+
db-location: "${{ runner.temp }}/customDbLocation"
14+
tools: ${{ steps.prepare-test.outputs.tools-url }}
15+
config-file: ./.github/codeql/codeql-config-query-filters1.yml
16+
registries-auth-tokens: https://ghcr.io/v2=${{ secrets.GITHUB_TOKEN }}
17+
# ensure test will fail if registries block is not used
18+
token: i-am-not-a-token
19+
env:
20+
TEST_MODE: true
21+
# ensure test will fail if registries block is not used
22+
GITHUB_TOKEN: i-am-not-a-token
23+
- name: Verify packages installed
24+
run: |
25+
PRIVATE_PACK="$HOME/.codeql/packages/dsp-testing/private-pack"
26+
CODEQL_PACK1="$HOME/.codeql/packages/dsp-testing/codeql-pack1"
27+
28+
if [[ -d $PRIVATE_PACK ]]
29+
then
30+
echo "$PRIVATE_PACK was installed."
31+
else
32+
echo "::error $PRIVATE_PACK pack was not installed."
33+
exit 1
34+
fi
35+
36+
if [[ -d $CODEQL_PACK1 ]]
37+
then
38+
echo "$CODEQL_PACK1 was installed."
39+
else
40+
echo "::error $CODEQL_PACK1 pack was not installed."
41+
exit 1
42+
fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Pack testing in the CodeQL Action
2+
3+
disable-default-queries: true
4+
packs:
5+
javascript:
6+
- dsp-testing/private-pack
7+
- dsp-testing/codeql-pack1
8+
9+
registries:
10+
# enforce using the registries block for all packs
11+
- url: https://ghcr.io/v2
12+
packages: "*"

0 commit comments

Comments
 (0)