-
Notifications
You must be signed in to change notification settings - Fork 1.1k
ci: require secrets.PYCLOUDLIB_TOML, add lxd_vm and ec2 scheduled jobs #6715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
blackboxsw
wants to merge
7
commits into
canonical:main
Choose a base branch
from
blackboxsw:ci-lxd-vm
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e32b9bf
chore(ci): rename and renumber workflow files to 1xx scheme
blackboxsw d6da62d
ci: require PYCLOUDLIB_TOML and SSH key secrets, write config to runn…
blackboxsw d4ef1d5
ci: add lxd_vm and EC2 integration test workflows
blackboxsw 24c62a7
ci: switch to pytest-json-ctrf and refactor job env/defaults
blackboxsw 9cd0ff6
ci: update image_type defaults, validate required secrets set perms
blackboxsw cbfe7c6
ci: rename PYCLOUDLIB_TOML_B64 to indicate base64-encoded
blackboxsw 30090a6
ci: standardize input/dispatch defaults, errors for missing secrets
blackboxsw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
13 changes: 0 additions & 13 deletions
13
.github/workflows/00-daily-integration-26.04-lxd-container.yml
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
.github/workflows/01-daily-integration-25.10-lxd-container.yml
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
.github/workflows/02-daily-integration-24.04-lxd-container.yml
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
.github/workflows/03-daily-integration-22.04-lxd-container.yml
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,165 @@ | ||
| # WARNING: This workflow handles repository secrets (PYCLOUDLIB_TOML_B64, SSH keys). | ||
| # It MUST NOT be triggered by PR-driven workflows to prevent secret exposure to | ||
| # untrusted code submitted via pull requests. | ||
| name: "Dispatch: Integration" | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| release: | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - resolute | ||
| - questing | ||
| - jammy | ||
| - noble | ||
| platform: | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - lxd_container | ||
| - lxd_vm | ||
| - ec2 | ||
| image_type: | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - generic | ||
| - minimal | ||
| install_source: | ||
| required: false | ||
| type: string | ||
| default: 'ppa:cloud-init-dev/daily' | ||
| filter_tests: | ||
| required: false | ||
| type: string | ||
| workflow_call: | ||
| inputs: | ||
| release: | ||
| required: true | ||
| type: string | ||
| platform: | ||
| required: true | ||
| type: string | ||
| image_type: | ||
| required: true | ||
| type: string | ||
| install_source: | ||
| required: true | ||
| type: string | ||
| filter_tests: | ||
| required: false | ||
| type: string | ||
| secrets: | ||
| PYCLOUDLIB_TOML_B64: | ||
| required: true | ||
| SSH_PRIVATE_KEY: | ||
| required: true | ||
| SSH_PUBLIC_KEY: | ||
| required: true | ||
|
|
||
| jobs: | ||
| integration-test: | ||
| runs-on: ubuntu-latest | ||
| if: github.repository == 'canonical/cloud-init' | ||
|
|
||
| env: | ||
| REQUIRED_SECRET: ${{ secrets.PYCLOUDLIB_TOML_B64 }} | ||
| SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | ||
| SSH_PUBLIC_KEY: ${{ secrets.SSH_PUBLIC_KEY }} | ||
| CLOUD_INIT_PLATFORM: ${{ inputs.platform }} | ||
| CLOUD_INIT_OS_IMAGE: ${{ inputs.release }} | ||
| CLOUD_INIT_OS_IMAGE_TYPE: ${{ inputs.image_type }} | ||
| CLOUD_INIT_CLOUD_INIT_SOURCE: ${{ inputs.install_source }} | ||
|
|
||
| steps: | ||
| - name: Assert required repo secrets are set | ||
| run: | | ||
| if [ -z "$REQUIRED_SECRET" ]; then | ||
| echo "ERROR: Missing required repo secret. Please provide the necessary repo secret at ${{ github.repository }}/settings/secrets/action." | ||
| exit 1 | ||
| fi | ||
| if [ -z "$SSH_PUBLIC_KEY" ]; then | ||
| echo "ERROR: Missing required repo secret. Please provide SSH_PUBLIC_KEY repo secret at ${{ github.repository }}/settings/secrets/actions." | ||
| exit 1 | ||
| fi | ||
| if [ -z "$SSH_PRIVATE_KEY" ]; then | ||
| echo "ERROR: Missing required repo secret. Please provide SSH_PRIVATE_KEY repo secret at ${{ github.repository }}/settings/secrets/actions." | ||
| exit 1 | ||
| fi | ||
| - name: Checkout | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| - name: Setup LXD | ||
| # Avoid unnecessary snap install lxd on non-lxd platforms. | ||
| if: ${{ contains(fromJSON('["lxd_vm", "lxd_container"]'), env.CLOUD_INIT_PLATFORM ) }} | ||
| uses: canonical/setup-lxd@8c6a87bfb56aa48f3fb9b830baa18562d8bfd4ee # v1 | ||
| with: | ||
| channel: 6/stable | ||
| - name: Clean workspace | ||
| run: | | ||
| rm -rf ${{ github.workspace }}/cloud_init_test_logs/ | ||
| - name: Setup SSH | ||
| run: | | ||
| mkdir -p ~/.ssh | ||
| # Dump secrets using a subprocess to avoid accidental leaks while debugging. | ||
| sh -c 'printf "%s\n" "$SSH_PUBLIC_KEY" > ~/.ssh/cloudinit_id_rsa.pub' | ||
| # Create empty cloudinit_id_rsa with file mode 600. | ||
| install -m 600 /dev/null ~/.ssh/cloudinit_id_rsa | ||
| sh -c 'printf "%s\n" "$SSH_PRIVATE_KEY" > ~/.ssh/cloudinit_id_rsa' | ||
| - name: Setup pycloudlib | ||
| env: | ||
| PYCLOUDLIB_CONFIG: ${{ runner.temp }}/pycloudlib.toml | ||
| run: | | ||
| sh -c 'echo "${{ secrets.PYCLOUDLIB_TOML_B64}}" | base64 -d > "$PYCLOUDLIB_CONFIG"' | ||
| - name: Install Dependencies | ||
| run: | | ||
| sudo DEBIAN_FRONTEND=noninteractive apt-get -qy update | ||
| sudo DEBIAN_FRONTEND=noninteractive apt-get -qy install tox distro-info-data devscripts | ||
| - name: Run integration Tests | ||
| env: | ||
| PYCLOUDLIB_CONFIG: ${{ runner.temp }}/pycloudlib.toml | ||
| CLOUD_INIT_LOCAL_LOG_PATH: ${{ github.workspace }}/cloud_init_test_logs | ||
| run: | | ||
| tox -e integration-tests -- --junitxml="${{ github.workspace }}/junit-report.xml" --color=yes ${{ inputs.filter_tests || 'tests/integration_tests' }} | ||
| - name: Publish Test Report with Insights | ||
| if: ${{ always() }} | ||
| uses: ctrf-io/github-test-reporter@024bc4b64d997ca9da86833c6b9548c55c620e40 # v1.0.26 | ||
| with: | ||
| report-path: '${{ github.workspace }}/junit-report.xml' | ||
| title: '${{ inputs.platform }}-${{ inputs.release }}-${{ inputs.image_type }}:${{ inputs.install_source }}' | ||
| integrations-config: | | ||
| { | ||
| "junit-to-ctrf": { | ||
| "enabled": true, | ||
| "action": "convert", | ||
| "options": { | ||
| "output": "./ctrf-report.json", | ||
| "toolname": "junit-to-ctrf", | ||
| "useSuiteName": false, | ||
| "env": { | ||
| "appName": "my-app" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| summary-delta-report: true | ||
| insights-report: true | ||
| flaky-rate-report: true | ||
| slowest-report: true | ||
| upload-artifact: true | ||
| github-report: true | ||
| artifact-name: ctrf-report-${{ inputs.platform }}-${{ inputs.release }} | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Upload failure artifacts | ||
| if: ${{ failure() }} | ||
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | ||
| with: | ||
| name: failure-${{ github.job }} | ||
| path: ${{ github.workspace }}/cloud_init_test_logs/ | ||
| retention-days: 2 | ||
| - name: Clean pycloudlib | ||
| if: ${{ always() }} | ||
| run: | | ||
| rm -f ${{ runner.temp }}/pycloudlib.toml | ||
This file was deleted.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
.github/workflows/110-daily-integration-22.04-lxd_container.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| name: "Daily 22.04: lxd_container" | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| install_source: | ||
| required: false | ||
| type: string | ||
| default: 'ppa:cloud-init-dev/daily' | ||
| image_type: | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - generic | ||
| - minimal | ||
| filter_tests: | ||
| required: false | ||
| type: string | ||
| schedule: | ||
| - cron: '2 22 * * *' | ||
|
|
||
| jobs: | ||
| jammy-lxd_container: | ||
| uses: ./.github/workflows/100-dispatch-common.yml | ||
| with: | ||
| release: jammy | ||
| platform: lxd_container | ||
| install_source: ${{ inputs.install_source || 'ppa:cloud-init-dev/daily' }} | ||
| image_type: ${{ inputs.image_type || 'generic' }} | ||
| filter_tests: ${{ inputs.filter_tests }} | ||
| secrets: | ||
| PYCLOUDLIB_TOML_B64: ${{ secrets.PYCLOUDLIB_TOML_B64 }} | ||
| SSH_PUBLIC_KEY: ${{ secrets.SSH_PUBLIC_KEY }} | ||
| SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't fully vetted this action yet. Were others considered?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had peeked at the following: