Skip to content

Commit

Permalink
feat: examples for reusable workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
clay-lake committed Dec 13, 2024
1 parent 78db3b8 commit d2f6f61
Show file tree
Hide file tree
Showing 11 changed files with 126 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/oci-factory_build_and_test_eicar_rock.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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.
name: OCI Factory Workflows - Build and Test EICAR Rock

on:
push:
paths:
- .github/workflows/build_and_test_eicar_rock.yaml
workflow_dispatch:

jobs:
build:
uses: canonical/oci-factory/.github/workflows/Build-Rock.yaml@main
with:
oci-archive-name: "eicar-rock"
rock-repo: canonical/rocks-toolbox
rock-repo-commit: rework_oci-factory_workflow_docs
rockfile-directory: eicar_rock/1.0/

test:
uses: canonical/oci-factory/.github/workflows/Test-Rock.yaml@main
needs: [build]
with:
oci-archive-name: "eicar-rock"
16 changes: 16 additions & 0 deletions .github/workflows/oci-factory_build_external_rock.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: OCI Factory Workflows - Build External Rock

on:
push:
paths:
- .github/workflows/build_external_rock.yaml
workflow_dispatch:

jobs:
build:
uses: canonical/oci-factory/.github/workflows/Build-Rock.yaml@main
with:
oci-archive-name: "chiselled-python"
rock-repo: canonical/chiselled-python
rock-repo-commit: e0943bf2923ef50c9117ac58cd02a86146ece1fb
rockfile-directory: python3.12/
16 changes: 16 additions & 0 deletions .github/workflows/oci-factory_build_mock_rock.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: OCI Factory Workflows - Build Mock Rock

on:
push:
paths:
- .github/workflows/build_mock_rock.yaml
workflow_dispatch:

jobs:
build:
uses: canonical/oci-factory/.github/workflows/Build-Rock.yaml@main
with:
oci-archive-name: "mock-rock"
rock-repo: canonical/rocks-toolbox
rock-repo-commit: main
rockfile-directory: mock_rock/1.0
40 changes: 40 additions & 0 deletions .github/workflows/oci-factory_test_external_rock.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# 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.
name: OCI Factory Workflows - Test External Rock

on:
push:
paths:
- .github/workflows/test_external_rock.yaml
workflow_dispatch:

env:
VULNERABILITY_REPORT_SUFFIX: '.vulnerability-report.json'
SKOPEO_IMAGE: 'quay.io/skopeo/stable:v1.15.1'
TEST_IMAGE: 'bkimminich/juice-shop'
TEST_IMAGE_FILENAME: 'juice-shop'

jobs:
setup:
runs-on: ubuntu-22.04
steps:
- run: |
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
-v $PWD:/workdir -w /workdir \
${{ env.SKOPEO_IMAGE }} \
copy docker://${{ env.TEST_IMAGE }} \
oci-archive:test_image
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: test_image
path: test_image
retention-days: 1

test:
uses: canonical/oci-factory/.github/workflows/Test-Rock.yaml@main
needs: [setup]
with:
oci-archive-name: test_image
test-black-box: false # will always fail since bkimminich/juice-shop is not a rock.

1 change: 1 addition & 0 deletions eicar_rock/1.0/eicar
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*
19 changes: 19 additions & 0 deletions eicar_rock/1.0/rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: eicar-rock
summary: A test rock to check malware scanners
description: An extension of the "Hello World" rock. This rock contains the EICAR test file to test if malware scanners are working as expected
version: "latest"
license: Apache-2.0

base: ubuntu@22.04
platforms:
amd64:

parts:
hello:
plugin: nil
stage-packages:
- hello
eicar:
plugin: dump
source-type: file
source: eicar
7 changes: 7 additions & 0 deletions oci-factory_reuseable_workflow_examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# OCI Factory Reusable Workflow Examples

This directory contains GitHub workflow examples which integrate reusable workflows
from the [OCI Factory](https://github.com/canonical/oci-factory).

Brief documentation for reusable these workflows and each example can be found in the
[OCI Factory README](https://github.com/canonical/oci-factory/blob/main/README.md).

0 comments on commit d2f6f61

Please sign in to comment.