-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path__test-action-get-image-name.yml
More file actions
98 lines (84 loc) · 3.44 KB
/
Copy path__test-action-get-image-name.yml
File metadata and controls
98 lines (84 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
---
name: Test for "docker/get-image-name" action
run-name: Test for "docker/get-image-name" action
on: # yamllint disable-line rule:truthy
workflow_call:
permissions: {}
jobs:
tests-with-implicit-repository:
name: Test for "docker/get-image-name" action
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- id: get-image-name
uses: ./actions/docker/get-image-name
with:
oci-registry: ghcr.io
image: application-test
- name: Check get image name outputs
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
IMAGE_NAME_OUTPUT: ${{ steps.get-image-name.outputs.image-name }}
FULL_IMAGE_NAME_OUTPUT: ${{ steps.get-image-name.outputs.image-name-with-registry }}
with:
script: |
/* jscpd:ignore-start */
const assert = require("assert");
const imageNameOutput = process.env.IMAGE_NAME_OUTPUT;
const fullImageNameOutput = process.env.FULL_IMAGE_NAME_OUTPUT;
assert(imageNameOutput.length, `"image-name" output is empty`);
assert.equal(
imageNameOutput,
"hoverkraft-tech/ci-github-container/application-test",
`"image-name" output is not valid`
);
assert(fullImageNameOutput.length, `"image-name-with-registry" output is empty`);
assert.equal(
fullImageNameOutput,
"ghcr.io/hoverkraft-tech/ci-github-container/application-test",
`"image-name-with-registry" output is not valid`
);
/* jscpd:ignore-end */
tests-with-given-repository:
name: Test for "docker/get-image-name" action with given repository
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- id: get-image-name
uses: ./actions/docker/get-image-name
with:
oci-registry: docker.io
image: application-test
repository: hoverkraft-tech/other-repository
- name: Check get image name output
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
IMAGE_NAME_OUTPUT: ${{ steps.get-image-name.outputs.image-name }}
FULL_IMAGE_NAME_OUTPUT: ${{ steps.get-image-name.outputs.image-name-with-registry }}
with:
script: |
/* jscpd:ignore-start */
const assert = require("assert");
const imageNameOutput = process.env.IMAGE_NAME_OUTPUT;
const fullImageNameOutput = process.env.FULL_IMAGE_NAME_OUTPUT;
assert(imageNameOutput.length, `"image-name" output is empty`);
assert.equal(
imageNameOutput,
"hoverkraft-tech/other-repository/application-test",
`"image-name" output is not valid`
);
assert(fullImageNameOutput.length, `"image-name-with-registry" output is empty`);
assert.equal(
fullImageNameOutput,
"docker.io/hoverkraft-tech/other-repository/application-test",
`"image-name-with-registry" output is not valid`
);
/* jscpd:ignore-end */