-
Notifications
You must be signed in to change notification settings - Fork 5
.github: workflows: rebase-and-build.yml: add #26
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
DaniilKl
wants to merge
1
commit into
master
Choose a base branch
from
add-rebase-workflow
base: master
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
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
There are no files selected for viewing
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,164 @@ | ||
| name: Rebase and build the last successful automatic rebase of aem-next branch | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
|
m-iwanicki marked this conversation as resolved.
|
||
| inputs: | ||
| dry_run: | ||
| description: > | ||
| Set this input to do a dry run without building the packages to test | ||
| the rebase. | ||
| required: false | ||
| type: boolean | ||
| default: false | ||
| schedule: | ||
| - cron: '0 0 * * 6' | ||
|
m-iwanicki marked this conversation as resolved.
|
||
|
|
||
| concurrency: | ||
| group: automatic-rebase | ||
|
|
||
| jobs: | ||
| prep-rebase: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout qubes-vmm-xen | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| repository: QubesOS/qubes-vmm-xen | ||
| path: qubes-vmm-xen | ||
| - name: Checkout downstream xen repository | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| repository: TrenchBoot/xen | ||
| token: ${{ secrets.TRENCHBOOT_REBASE_TOKEN }} | ||
| path: xen | ||
| - name: Read upstream version from qubes-vmm-xen | ||
| id: version | ||
| working-directory: qubes-vmm-xen | ||
| run: echo "version=$(cat version)" >> "$GITHUB_OUTPUT" | ||
| - name: Add upstream remote and fetch version tag | ||
| working-directory: xen | ||
| env: | ||
| UPSTREAM_TAG: RELEASE-${{ steps.version.outputs.version }} | ||
| run: | | ||
| git remote add upstream https://xenbits.xenproject.org/git-http/xen.git | ||
| git fetch upstream "refs/tags/${UPSTREAM_TAG}:refs/tags/${UPSTREAM_TAG}" | ||
| - name: Apply qubes-vmm-xen patches on top of upstream tag | ||
| working-directory: xen | ||
| env: | ||
| UPSTREAM_TAG: RELEASE-${{ steps.version.outputs.version }} | ||
| run: | | ||
| git checkout -b qubes-vmm-xen-with-patches-rebase-prep "$UPSTREAM_TAG" | ||
| SPEC="../qubes-vmm-xen/xen.spec.in" | ||
| mapfile -t PATCHES < <(grep -E '^Patch[0-9]+:' "$SPEC" | awk '{print $2}') | ||
| for patch_file in "${PATCHES[@]}"; do | ||
| git apply "../qubes-vmm-xen/${patch_file}" | ||
| escaped=$(printf '%s' "$patch_file" | sed 's/\./\\./g') | ||
| sed -i "/^Patch[0-9]*:[[:space:]]*${escaped}[[:space:]]*$/d" "$SPEC" | ||
| rm -f "../qubes-vmm-xen/${patch_file}" | ||
| done | ||
| - name: Copy QubesOS RPM files to downstream repository, rename spec.in | ||
| # Notes: | ||
| # 1. Renaming QubesOS/qubes-vmm-xen/config to | ||
| # TrenchBoot/xen/config-qubesos, so it will not conflict with an | ||
| # already existing directory "config" in the xen source code. | ||
| # 2. Renaming QubesOS/qubes-vmm-xen/xen.spec.in to | ||
| # QubesOS/qubes-vmm-xen/vmm-xen.spec.in. This is done because the | ||
| # qubes-dom0-packagev2.yml expects the file to have a name | ||
| # ${{ inputs.qubes-component }}.spec.in and the correct name for this | ||
| # component in QubesOS is vmm-xen, not xen. | ||
| run: | | ||
| mv qubes-vmm-xen/config qubes-vmm-xen/config-qubesos | ||
|
m-iwanicki marked this conversation as resolved.
|
||
| sed -i 's/^Source3:[[:space:]]*config$/Source3: config-qubesos/' qubes-vmm-xen/xen.spec.in | ||
| cp -r qubes-vmm-xen/* xen/ | ||
|
m-iwanicki marked this conversation as resolved.
|
||
| mv xen/xen.spec.in xen/vmm-xen.spec.in | ||
| cd xen | ||
| git add -A | ||
| GIT_AUTHOR_NAME="github-actions[bot]" \ | ||
| GIT_AUTHOR_EMAIL="github-actions[bot]@users.noreply.github.com" \ | ||
| GIT_AUTHOR_DATE="2024-01-01T00:00:00" \ | ||
| GIT_COMMITTER_NAME="github-actions[bot]" \ | ||
| GIT_COMMITTER_EMAIL="github-actions[bot]@users.noreply.github.com" \ | ||
| GIT_COMMITTER_DATE="2024-01-01T00:00:00" \ | ||
| git commit --no-gpg-sign -m "QubesOS patches, QubesOS RPM files and Qubes builder metadata" | ||
| - name: Push qubes-vmm-xen-with-patches branch to downstream | ||
| working-directory: xen | ||
| run: git push origin qubes-vmm-xen-with-patches-rebase-prep | ||
|
m-iwanicki marked this conversation as resolved.
|
||
| try-rebase: | ||
| needs: prep-rebase | ||
| uses: TrenchBoot/.github/.github/workflows/rebase.yml@v1 | ||
| secrets: | ||
| first-remote-token: ${{secrets.TRENCHBOOT_REBASE_TOKEN}} | ||
| permissions: | ||
| # For creation/deletion/pushing to branches and creating PRs | ||
| contents: write | ||
| with: | ||
| downstream-repo: 'https://github.com/TrenchBoot/xen.git' | ||
| downstream-branch: 'aem-next' | ||
| upstream-repo: 'https://github.com/TrenchBoot/xen.git' | ||
| upstream-branch: 'qubes-vmm-xen-with-patches-rebase-prep' | ||
| commit-user-name: 'github-actions[bot]' | ||
| commit-user-email: 'github-actions[bot]@users.noreply.github.com' | ||
| cicd-trigger-resume: '7. Rerun the workflow https://github.com/TrenchBoot/xen/actions/runs/${{ github.run_id }} to resume automated rebase.' | ||
| cleanup-after-rebase-attempt: | ||
| needs: try-rebase | ||
| if: always() | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout downstream xen repository | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| repository: TrenchBoot/xen | ||
| token: ${{ secrets.TRENCHBOOT_REBASE_TOKEN }} | ||
| path: xen | ||
| - name: Delete qubes-vmm-xen-with-patches branch from downstream | ||
| working-directory: xen | ||
| env: | ||
| TOKEN: ${{ secrets.TRENCHBOOT_REBASE_TOKEN }} | ||
| run: | | ||
| git push "https://${TOKEN}@github.com/TrenchBoot/xen.git" \ | ||
| --delete qubes-vmm-xen-with-patches-rebase-prep | ||
| get-version: | ||
| runs-on: ubuntu-latest | ||
| needs: try-rebase | ||
| if: ${{ needs.try-rebase.outputs.rebase-exit-code == '0' && inputs.dry_run != 'true' }} | ||
| outputs: | ||
| version: ${{ steps.read-version.outputs.version }} | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| ref: 'aem-next-rebased' | ||
| - name: Read version of the QubesOS Component from version file | ||
| id: read-version | ||
| # The aem-next-rebased should already have the version file either created | ||
| # in the prep-rebase or try-rebase jobs (it will be probably created by | ||
| # the prep-rebase as this file is a part of QubesOS repository) on which | ||
| # it depennds: | ||
| run: echo "version=$(cat version)" >> "$GITHUB_OUTPUT" | ||
|
SergiiDmytruk marked this conversation as resolved.
|
||
| qubes-dom0-package: | ||
| needs: get-version | ||
| uses: TrenchBoot/.github/.github/workflows/qubes-dom0-packagev2.yml@v1 | ||
| with: | ||
| qubes-component: 'vmm-xen' | ||
| qubes-component-branch: 'aem-next-rebased' | ||
| qubes-pkg-src-dir: '.' | ||
| qubes-pkg-version: ${{ needs.get-version.outputs.version }} | ||
| trigger-woodpecker-cicd: | ||
| needs: qubes-dom0-package | ||
| uses: TrenchBoot/.github/.github/workflows/trigger-woodpecker-pipeline.yml@v1 | ||
| secrets: | ||
| woodpecker-token: ${{ secrets.WOODPECKER_TOKEN }} | ||
| with: | ||
| api-url: 'https://ci.3mdeb.com' | ||
| owner: 'zarhus' | ||
| repo: 'trenchboot-release-cicd-pipeline' | ||
| ref: 'master' | ||
| inputs: >- | ||
| --input GITHUB_REPO=xen | ||
| --input GITHUB_SHA=${{ github.sha }} | ||
|
m-iwanicki marked this conversation as resolved.
|
||
| --input GITHUB_RUN_ID=${{ github.run_id }} | ||
| --input QUBES_COMPONENT=vmm-xen | ||
| --input WORKFLOW=sign-and-publish-test-rpms | ||
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'm not sure if we want Qubes patches on aem-next branch? We are/were using this branch for e.g. upstreaming Trenchboot changes. Maybe separate
qubes+aem-nextbranch?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 am not sure too, lets wait for the maintainers to share their opinion: https://matrix.to/#/!WHWPvnIGPhGGtUFucJ:matrix.org/$N7FMWWIoHr1YYAv2iUcKaVgffxHm6C3ekj76h6xYQpo?via=matrix.org&via=matrix.tu-berlin.de&via=invisiblethingslab.com .
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.
Considering the answer: https://matrix.to/#/!WHWPvnIGPhGGtUFucJ:matrix.org/$Q_vxQEooVvzAs3ienpZNHQ8MMaxdyJ51cybIrmUjDvo?via=matrix.org&via=matrix.tu-berlin.de&via=invisiblethingslab.com, you are right, a separate branch for QubesOS things should be created and the auto-rebase should be run there, not on the aem-next branch.
The only thing that should be changed because of this fact in this PR - are the branches though, all the other things should stay untouched. So we can continue review, but this will be a bloker for the final merge.
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.
Maybe we can use CI variables to specify branches? This way we don't have to hard-code names in commits and can change easily in the future. Although, I'm not sure how often this will change, so it may not be worth it.