Skip to content

Commit 853751c

Browse files
authored
Update Trivy scan workflows (#676)
1 parent af573f3 commit 853751c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+8960
-37
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright The ORAS Authors.
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
version: 2
15+
16+
updates:
17+
- package-ecosystem: "github-actions"
18+
# Workflow files stored in the
19+
# default location of `.github/workflows`
20+
directory: "/"
21+
schedule:
22+
interval: "weekly"
23+
labels:
24+
- "dependencies"
25+
- package-ecosystem: "npm"
26+
directory: "/"
27+
schedule:
28+
interval: "weekly"
29+
labels:
30+
- "dependencies"
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright The ORAS Authors.
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
header:
15+
license:
16+
spdx-id: Apache-2.0
17+
content: |
18+
Copyright The ORAS Authors.
19+
Licensed under the Apache License, Version 2.0 (the "License");
20+
you may not use this file except in compliance with the License.
21+
You may obtain a copy of the License at
22+
23+
http://www.apache.org/licenses/LICENSE-2.0
24+
25+
Unless required by applicable law or agreed to in writing, software
26+
distributed under the License is distributed on an "AS IS" BASIS,
27+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28+
See the License for the specific language governing permissions and
29+
limitations under the License.
30+
31+
paths-ignore:
32+
- '**/*.json'
33+
- '**/*.md'
34+
- 'dist/**'
35+
- 'CODEOWNERS'
36+
- 'LICENSE'
37+
38+
comment: on-failure
39+
40+
dependency:
41+
files:
42+
- package.json
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Copyright The ORAS Authors.
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
name: Check dist/
15+
16+
on:
17+
push:
18+
paths-ignore:
19+
- '**.md'
20+
pull_request:
21+
paths-ignore:
22+
- '**.md'
23+
workflow_dispatch:
24+
25+
jobs:
26+
check-dist:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v4
30+
- name: remove js files in dist/
31+
run: find dist/ -type f \( -name "*.json" -o -name "*.js" -o -name "*.js.map" \) -delete
32+
- name: Setup Node 16.x
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: 16.x
36+
cache: npm
37+
- name: Install dependencies
38+
run: npm install
39+
- name: Rebuild the dist/ directory
40+
run: npm run build
41+
- name: Compare the expected and actual dist/ directories
42+
run: |
43+
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
44+
echo "DIFFERENCES DETECTED: 'npm run build' is needed after code changes. See status below:"
45+
git diff
46+
exit 1
47+
fi
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Copyright The ORAS Authors.
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
name: License Checker
15+
16+
on:
17+
push:
18+
branches:
19+
- main
20+
- release-*
21+
pull_request:
22+
branches:
23+
- main
24+
- release-*
25+
26+
permissions:
27+
contents: write
28+
pull-requests: write
29+
30+
jobs:
31+
check-license:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
- name: Check license header
37+
uses: apache/skywalking-eyes/header@v0.6.0
38+
with:
39+
mode: check
40+
config: .github/licenserc.yml
41+
- name: Check dependencies license
42+
uses: apache/skywalking-eyes/dependency@v0.6.0
43+
with:
44+
config: .github/licenserc.yml
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# Copyright The ORAS Authors.
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
name: Tests
15+
16+
on:
17+
push:
18+
branches:
19+
- main
20+
- release-*
21+
pull_request:
22+
branches:
23+
- main
24+
- release-*
25+
26+
defaults:
27+
run:
28+
shell: bash
29+
30+
jobs:
31+
test-basic-setup:
32+
name: Test Setup ORAS CLI
33+
runs-on: ${{ matrix.os }}
34+
strategy:
35+
matrix:
36+
os: [macos-latest, windows-latest, ubuntu-latest]
37+
version:
38+
- 1.1.0
39+
- 1.2.0
40+
fail-fast: true
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v4
44+
45+
- name: Setup ORAS v${{ matrix.version }}
46+
uses: ./
47+
with:
48+
version: ${{ matrix.version }}
49+
50+
- name: Verify ORAS version installed
51+
env:
52+
ORAS_VERSION_EXPECTED: ${{ matrix.version }}
53+
run: |
54+
echo ---
55+
oras version
56+
echo ---
57+
read -ra ORAS_VERSION_INSTALLED <<<$(oras version)
58+
[ "${ORAS_VERSION_INSTALLED[1]}" == "$ORAS_VERSION_EXPECTED" ]
59+
60+
create-test-variables:
61+
runs-on: ubuntu-latest
62+
outputs:
63+
url: ${{ steps.get-checksum-url.outputs.URL }}
64+
checksum: ${{ steps.get-checksum-url.outputs.CHECKSUM }}
65+
steps:
66+
- id: checkout
67+
uses: actions/checkout@v4
68+
- id: get-checksum-url
69+
run: |
70+
RELEASE=$(jq -r 'keys_unsorted[0] as $k | .[$k].linux.amd64' src/lib/data/releases.json)
71+
echo "CHECKSUM=$(echo $RELEASE | jq -r '.checksum')" >> "$GITHUB_OUTPUT"
72+
echo "URL=$(echo $RELEASE | jq -r '.url')" >> "$GITHUB_OUTPUT"
73+
74+
test-custom-url:
75+
name: Test Setup using URL
76+
runs-on: ubuntu-latest
77+
needs: create-test-variables
78+
steps:
79+
- name: Checkout
80+
uses: actions/checkout@v4
81+
82+
- name: Setup ORAS using URL
83+
uses: ./
84+
with:
85+
url: ${{ needs.create-test-variables.outputs.url }}
86+
checksum: ${{ needs.create-test-variables.outputs.checksum }}
87+
88+
- name: Setup ORAS using URL without checksum
89+
id: no-checksum
90+
continue-on-error: true
91+
uses: ./
92+
with:
93+
url: ${{ needs.create-test-variables.outputs.url }}
94+
- name: 'Should Fail: Setup ORAS using URL without checksum'
95+
if: steps.no-checksum.outcome != 'failure'
96+
run: |
97+
echo "Setup ORAS using URL without checksum should fail, but succeeded."
98+
exit 1
99+
100+
- name: Setup ORAS using checksum without url
101+
id: no-url
102+
continue-on-error: true
103+
uses: ./
104+
with:
105+
checksum: ${{ needs.create-test-variables.outputs.checksum }}
106+
- name: 'Should Fail: Setup ORAS using checksum without url'
107+
if: steps.no-url.outcome != 'failure'
108+
run: |
109+
echo "Setup ORAS using checksum without url should fail, but succeeded."
110+
exit 1
111+
112+
- name: Setup ORAS using URL and invalid checksum
113+
id: invalid-checksum
114+
continue-on-error: true
115+
uses: ./
116+
with:
117+
url: ${{ needs.create-test-variables.outputs.url }}
118+
checksum: abcedf
119+
- name: 'Should Fail: Setup ORAS using URL and invalid checksum'
120+
if: steps.invalid-checksum.outcome != 'failure'
121+
run: |
122+
echo "Setup ORAS using URL and invalid checksum should fail, but succeeded."
123+
exit 1
124+
125+
- name: Setup ORAS using invalid URL
126+
id: invalid-url
127+
continue-on-error: true
128+
uses: ./
129+
with:
130+
url: invalid-url
131+
checksum: test
132+
- name: 'Should Fail: Setup ORAS using invalid URL'
133+
if: steps.invalid-url.outcome != 'failure'
134+
run: |
135+
echo "Setup ORAS using invalid URL should fail, but succeeded."
136+
exit 1
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Copyright The ORAS Authors.
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
name: Update major and minor tags
15+
16+
on:
17+
release:
18+
types: [published]
19+
20+
jobs:
21+
update-major-minor-tags:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
with:
27+
ref: ${{ github.event.release.tag_name }}
28+
- name: Git config
29+
run: |
30+
git config user.name github-actions
31+
git config user.email github-actions@github.com
32+
- name: Tag and push new major and minor versions
33+
run: |
34+
VERSION=${{ github.event.release.tag_name }}
35+
MAJOR=$(echo ${VERSION} | cut -d '.' -f 1)
36+
MINOR=${MAJOR}.$(echo ${VERSION} | cut -d '.' -f 2)
37+
if [ -z ${VERSION} ]
38+
then
39+
echo "released tag cannot be empty"
40+
exit 1
41+
else
42+
echo "released tag is ${VERSION}"
43+
fi
44+
if [ -z ${MAJOR} ]
45+
then
46+
echo "major tag cannot be empty"
47+
exit 1
48+
else
49+
echo "major tag is ${MAJOR}"
50+
fi
51+
if [ -z ${MINOR} ]
52+
then
53+
echo "minor tag cannot be empty"
54+
exit 1
55+
else
56+
echo "minor tag is ${MINOR}"
57+
fi
58+
git tag -f ${MAJOR} ${VERSION}
59+
git tag -f ${MINOR} ${VERSION}
60+
git push origin ${MAJOR} --force
61+
git push origin ${MINOR} --force

.github/actions/setup-oras-1.2.1/.gitignore

Whitespace-only changes.

.github/actions/setup-oras-1.2.1/CODEOWNERS

Whitespace-only changes.

.github/actions/setup-oras-1.2.1/CODE_OF_CONDUCT.md

Whitespace-only changes.

.github/actions/setup-oras-1.2.1/LICENSE

Whitespace-only changes.

0 commit comments

Comments
 (0)