Skip to content

Commit 9ffb540

Browse files
authored
feat: examples for reusable workflows (#21)
1 parent 78db3b8 commit 9ffb540

11 files changed

+126
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Warning: This workflow is designed to fail. When merging in a PR, pushing an empty commit will bypass checks and allow the PR to be merged.
2+
name: OCI Factory Workflows - Build and Test EICAR Rock
3+
4+
on:
5+
push:
6+
paths:
7+
- .github/workflows/build_and_test_eicar_rock.yaml
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
uses: canonical/oci-factory/.github/workflows/Build-Rock.yaml@main
13+
with:
14+
oci-archive-name: "eicar-rock"
15+
rock-repo: canonical/rocks-toolbox
16+
rock-repo-commit: rework_oci-factory_workflow_docs
17+
rockfile-directory: eicar_rock/1.0/
18+
19+
test:
20+
uses: canonical/oci-factory/.github/workflows/Test-Rock.yaml@main
21+
needs: [build]
22+
with:
23+
oci-archive-name: "eicar-rock"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: OCI Factory Workflows - Build External Rock
2+
3+
on:
4+
push:
5+
paths:
6+
- .github/workflows/build_external_rock.yaml
7+
workflow_dispatch:
8+
9+
jobs:
10+
build:
11+
uses: canonical/oci-factory/.github/workflows/Build-Rock.yaml@main
12+
with:
13+
oci-archive-name: "chiselled-python"
14+
rock-repo: canonical/chiselled-python
15+
rock-repo-commit: e0943bf2923ef50c9117ac58cd02a86146ece1fb
16+
rockfile-directory: python3.12/
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: OCI Factory Workflows - Build Mock Rock
2+
3+
on:
4+
push:
5+
paths:
6+
- .github/workflows/build_mock_rock.yaml
7+
workflow_dispatch:
8+
9+
jobs:
10+
build:
11+
uses: canonical/oci-factory/.github/workflows/Build-Rock.yaml@main
12+
with:
13+
oci-archive-name: "mock-rock"
14+
rock-repo: canonical/rocks-toolbox
15+
rock-repo-commit: main
16+
rockfile-directory: mock_rock/1.0
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Warning: This workflow is designed to fail. When merging in a PR, pushing an empty commit will bypass checks and allow the PR to be merged.
2+
name: OCI Factory Workflows - Test External Rock
3+
4+
on:
5+
push:
6+
paths:
7+
- .github/workflows/test_external_rock.yaml
8+
workflow_dispatch:
9+
10+
env:
11+
VULNERABILITY_REPORT_SUFFIX: '.vulnerability-report.json'
12+
SKOPEO_IMAGE: 'quay.io/skopeo/stable:v1.15.1'
13+
TEST_IMAGE: 'bkimminich/juice-shop'
14+
TEST_IMAGE_FILENAME: 'juice-shop'
15+
16+
jobs:
17+
setup:
18+
runs-on: ubuntu-22.04
19+
steps:
20+
- run: |
21+
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
22+
-v $PWD:/workdir -w /workdir \
23+
${{ env.SKOPEO_IMAGE }} \
24+
copy docker://${{ env.TEST_IMAGE }} \
25+
oci-archive:test_image
26+
27+
- uses: actions/upload-artifact@v4
28+
if: ${{ !cancelled() }}
29+
with:
30+
name: test_image
31+
path: test_image
32+
retention-days: 1
33+
34+
test:
35+
uses: canonical/oci-factory/.github/workflows/Test-Rock.yaml@main
36+
needs: [setup]
37+
with:
38+
oci-archive-name: test_image
39+
test-black-box: false # will always fail since bkimminich/juice-shop is not a rock.
40+

eicar_rock/1.0/eicar

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*

eicar_rock/1.0/rockcraft.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: eicar-rock
2+
summary: A test rock to check malware scanners
3+
description: An extension of the "Hello World" rock. This rock contains the EICAR test file to test if malware scanners are working as expected
4+
version: "latest"
5+
license: Apache-2.0
6+
7+
8+
platforms:
9+
amd64:
10+
11+
parts:
12+
hello:
13+
plugin: nil
14+
stage-packages:
15+
- hello
16+
eicar:
17+
plugin: dump
18+
source-type: file
19+
source: eicar
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# OCI Factory Reusable Workflow Examples
2+
3+
This directory contains GitHub workflow examples which integrate reusable workflows
4+
from the [OCI Factory](https://github.com/canonical/oci-factory).
5+
6+
Brief documentation for reusable these workflows and each example can be found in the
7+
[OCI Factory README](https://github.com/canonical/oci-factory/blob/main/README.md).
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../.github/workflows/oci-factory_build_and_test_eicar_rock.yaml
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../.github/workflows/oci-factory_build_external_rock.yaml
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../.github/workflows/oci-factory_build_mock_rock.yaml

0 commit comments

Comments
 (0)