Skip to content

Commit

Permalink
fix: add missing conditionals to optional jobs in test rock (#299)
Browse files Browse the repository at this point in the history
* fix: add missing test job conditionals
---------

Co-authored-by: clay-lake <clay-lake@localhost>
  • Loading branch information
clay-lake and clay-lake authored Dec 4, 2024
1 parent b9a0d39 commit dd8e53d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 19 deletions.
25 changes: 18 additions & 7 deletions .github/workflows/Test-Rock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ on:
default: true
type: boolean

## Rock black-box Test
test-black-box:
description: "Enable rock black-box test."
default: true
type: boolean

## Image Efficiency Test
test-efficiency:
description: "Enable image efficiency test."
Expand All @@ -34,7 +40,7 @@ on:
type: string

## Malware Test
test_malware:
test-malware:
description: "Enable malware test."
default: true
type: boolean
Expand Down Expand Up @@ -75,8 +81,8 @@ jobs:
ref: ${{ steps.workflow-version.outputs.sha }}
fetch-depth: 1

# download and unpacks the image under test, then store it under a common cache key.
# This unpacked image is used in test-oci-compliance and test_malware jobs
# download and unpack the image under test, then store it under a common cache key.
# This unpacked image is used in test-oci-compliance, test-black-box and test-malware jobs
- name: Download Rock
uses: actions/download-artifact@v4
with:
Expand Down Expand Up @@ -105,6 +111,7 @@ jobs:
runs-on: ubuntu-22.04
name: "test-oci-compliance ${{ inputs.oci-archive-name != '' && format('| {0}', inputs.oci-archive-name) || ' '}}"
needs: [configure-tests]
if: inputs.test-oci-compliance
steps:
- uses: actions/cache/restore@v4
with:
Expand Down Expand Up @@ -132,6 +139,7 @@ jobs:
runs-on: ${{ matrix.os }}
name: "test-black-box ${{ inputs.oci-archive-name != '' && format('| {0}', inputs.oci-archive-name) || ' '}}"
needs: [configure-tests]
if: inputs.test-black-box
steps:
- uses: actions/cache/restore@v4
with:
Expand All @@ -146,22 +154,23 @@ jobs:
copy oci:${{ env.TEST_IMAGE_NAME }}:${{ env.TEST_IMAGE_TAG }} \
docker-daemon:${{ env.TEST_IMAGE_NAME }}:${{ env.TEST_IMAGE_TAG }}
- name: Create container
run: |
docker create ${{ env.TEST_IMAGE_NAME }}:${{ env.TEST_IMAGE_TAG }}
- name: Test rock
run: |
set -ex
docker run --rm ${{ env.TEST_IMAGE_NAME }}:${{ env.TEST_IMAGE_TAG }} \
help | grep Pebble
- name: Create container
run: |
docker create ${{ env.TEST_IMAGE_NAME }}:${{ env.TEST_IMAGE_TAG }}
test-efficiency:
runs-on: ubuntu-22.04
name: "test-efficiency ${{ inputs.oci-archive-name != '' && format('| {0}', inputs.oci-archive-name) || ' '}}"
needs: [configure-tests]
# TODO: remove once https://chat.charmhub.io/charmhub/pl/o5wxpb65ffbfzy7bcmi8kzftzy is fixed
continue-on-error: true
if: inputs.test-efficiency
steps:

- name: Cloning OCI Factory
Expand Down Expand Up @@ -199,6 +208,7 @@ jobs:
runs-on: ubuntu-22.04
name: "test-vulnerabilities ${{ inputs.oci-archive-name != '' && format('| {0}', inputs.oci-archive-name) || ' '}}"
needs: [configure-tests]
if: inputs.test-vulnerabilities
steps:

- name: Cloning OCI Factory
Expand Down Expand Up @@ -265,6 +275,7 @@ jobs:
runs-on: ubuntu-22.04
name: "test-malware ${{ inputs.oci-archive-name != '' && format('| {0}', inputs.oci-archive-name) || ' '}}"
needs: [configure-tests]
if: inputs.test-malware
steps:
- name: Cloning OCI Factory
uses: actions/checkout@v4
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/Vulnerability-Scan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ jobs:
with:
oci-archive-name: ${{ needs.configure-scan.outputs.oci-image }}
test-vulnerabilities: true # just incase we set this to false by default in the future
test-oci-compliance: false
test-black-box: false
test-efficiency: false
test_malware: false
test-malware: false
test-oci-compliance: false

parse-results:
name: "parse-results ${{ inputs.oci-image-name != '' && format('| {0}', inputs.oci-image-name) || ' '}}"
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/_Test-OCI-Factory.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,12 @@ jobs:
# needs: [build-rock]
# with:
# oci-archive-name: "mock-rock"
# test-vulnerabilities: true
# test-oci-compliance: true
# test-black-box: true
# test-efficiency: true
# test_malware: true
# test-malware: true
# test-oci-compliance: true
# test-vulnerabilities: true


# # Test workflow used in continuous testing
# test-vulnerability-scan:
Expand Down
14 changes: 7 additions & 7 deletions oci/mock-rock/_releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,31 +35,31 @@
"1.1-22.04": {
"end-of-life": "2030-05-01T00:00:00Z",
"candidate": {
"target": "960"
"target": "963"
},
"beta": {
"target": "960"
"target": "963"
},
"edge": {
"target": "960"
"target": "963"
}
},
"1-22.04": {
"end-of-life": "2030-05-01T00:00:00Z",
"candidate": {
"target": "960"
"target": "963"
},
"beta": {
"target": "960"
"target": "963"
},
"edge": {
"target": "960"
"target": "963"
}
},
"1.2-22.04": {
"end-of-life": "2030-05-01T00:00:00Z",
"beta": {
"target": "961"
"target": "964"
},
"edge": {
"target": "1.2-22.04_beta"
Expand Down

0 comments on commit dd8e53d

Please sign in to comment.