-
Notifications
You must be signed in to change notification settings - Fork 0
Switch to custom fc repo; Improve build system #3
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
ValentaTomas
wants to merge
14
commits into
main
Choose a base branch
from
refactor
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 7 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5da78a6
Refactor
ValentaTomas 2707785
Fix naming
ValentaTomas 1253e0b
Fix ci checks
ValentaTomas 7a35a2e
Trigger CI check on PRs too
ValentaTomas 4477a50
Add extra checks
ValentaTomas 42a22f3
Enhance CI status checks in script to include total counts and handle…
ValentaTomas a45d039
Cleanup
ValentaTomas 8718536
Refactor
ValentaTomas 9b6acfe
Cleanup
ValentaTomas 1d90ec2
Cleanup
ValentaTomas 2900ebe
Cleanup
ValentaTomas a8651b4
Cleanup
ValentaTomas 7fb60bf
Cleanup
ValentaTomas d7b3db0
Remove local build as that should be done via the custom FC repo duri…
ValentaTomas 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
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,50 @@ | ||
| name: Build Firecracker Versions | ||
|
|
||
| on: | ||
| workflow_call: | ||
| outputs: | ||
| versions: | ||
| description: "JSON array of versions that were built" | ||
| value: ${{ jobs.prepare.outputs.versions }} | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| prepare: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| versions: ${{ steps.set-versions.outputs.versions }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Parse versions from file | ||
| id: set-versions | ||
| run: | | ||
| versions=$(./scripts/parse-versions.sh firecracker_versions.txt) | ||
| echo "versions=$versions" >> $GITHUB_OUTPUT | ||
| echo "Building versions: $versions" | ||
|
|
||
| build: | ||
| needs: prepare | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: true | ||
| matrix: | ||
| version: ${{ fromJson(needs.prepare.outputs.versions) }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Build Firecracker ${{ matrix.version }} | ||
| id: build | ||
| run: | | ||
| ./build.sh "${{ matrix.version }}" | ||
| # Read the computed version name (with hash) - format is "version_name:commit_hash" | ||
| version_info=$(cat built_versions.txt | tail -1) | ||
| version_name=$(echo "$version_info" | cut -d: -f1) | ||
| echo "version_name=$version_name" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Upload build artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: firecracker-${{ steps.build.outputs.version_name }} | ||
| path: builds/ | ||
| retention-days: 7 | ||
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 |
|---|---|---|
|
|
@@ -2,105 +2,121 @@ name: FC Versions | |
|
|
||
| on: | ||
| push: | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| id-token: write | ||
| contents: write | ||
|
|
||
| jobs: | ||
| # Run parallel builds via reusable workflow | ||
|
||
| build: | ||
| uses: ./.github/workflows/build.yml | ||
|
|
||
| # Check CI status in parallel with builds (for faster feedback) | ||
| check-ci: | ||
ValentaTomas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| name: Check FC repo CI status | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| ci_passed: ${{ steps.ci-check.outputs.ci_passed }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Check CI status for all versions | ||
| id: ci-check | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| output=$(./scripts/check-fc-ci.sh firecracker_versions.txt) | ||
| echo "$output" | ||
| # Extract ci_passed from last line | ||
| ci_passed=$(echo "$output" | grep "^ci_passed=" | cut -d= -f2) | ||
| echo "ci_passed=$ci_passed" >> $GITHUB_OUTPUT | ||
|
|
||
| # Collect artifacts and publish (waits for both build and CI check) | ||
| publish: | ||
| name: Build Firecracker and upload | ||
| name: Collect and upload builds | ||
| needs: [build, check-ci] | ||
| runs-on: ubuntu-22.04 | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/create-github-app-token@v1 | ||
| id: app-token | ||
| with: | ||
| app-id: ${{ vars.VERSION_BUMPER_APPID }} | ||
| private-key: ${{ secrets.VERSION_BUMPER_SECRET }} | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Get the last release | ||
| id: last_release | ||
| continue-on-error: true | ||
| uses: cardinalby/git-get-release-action@v1 | ||
| env: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
| # Download all build artifacts | ||
| - name: Download all build artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| latest: true | ||
| prerelease: false | ||
| draft: false | ||
| path: builds | ||
| pattern: firecracker-* | ||
| merge-multiple: true | ||
|
|
||
| - name: List downloaded builds | ||
| run: find builds -type f | head -20 | ||
|
|
||
| - name: Get next version | ||
| id: get-version | ||
| - name: CI check result | ||
| run: | | ||
| if [ "${{ steps.last_release.outputs.tag_name }}" == "" ]; then | ||
| echo "No previous release found, starting with v0.0.1" | ||
| echo "version=v0.0.1" >> $GITHUB_OUTPUT | ||
| else | ||
| version=${{ steps.last_release.outputs.tag_name }} | ||
| result=$(echo ${version} | awk -F. -v OFS=. '{$NF += 1 ; print}') | ||
| echo "version=$result" >> $GITHUB_OUTPUT | ||
| echo "CI check passed: ${{ needs.check-ci.outputs.ci_passed }}" | ||
| if [[ "${{ needs.check-ci.outputs.ci_passed }}" != "true" ]]; then | ||
| echo "⚠️ CI checks did not pass - skipping GCS upload and release" | ||
| fi | ||
|
|
||
| - name: Test next version | ||
| run: echo "Next version is ${{ steps.get-version.outputs.version }}" | ||
|
|
||
| - name: Setup Service Account | ||
| if: github.ref_name == 'main' && needs.check-ci.outputs.ci_passed == 'true' | ||
| uses: google-github-actions/auth@v2 | ||
| with: | ||
| project_id: ${{ secrets.GCP_PROJECT_ID }} | ||
| workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} | ||
|
|
||
| - name: Build firecrackers | ||
| run: sudo make build | ||
|
|
||
| - name: Upload firecrackers as artifact | ||
| if: github.ref_name != 'main' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: firecracker-${{ github.run_id }} | ||
| path: ./builds | ||
| retention-days: 7 | ||
|
|
||
| - name: Upload firecrackers to GCS | ||
| if: github.ref_name == 'main' | ||
| if: github.ref_name == 'main' && needs.check-ci.outputs.ci_passed == 'true' | ||
| uses: "google-github-actions/upload-cloud-storage@v1" | ||
| with: | ||
| path: "./builds" | ||
| destination: ${{ vars.GCP_BUCKET_NAME }}/firecrackers | ||
| gzip: false | ||
| parent: false | ||
|
|
||
| - name: Create Git tag | ||
| if: github.ref_name == 'main' | ||
| - name: Create releases for each Firecracker version | ||
| if: github.ref_name == 'main' && needs.check-ci.outputs.ci_passed == 'true' | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| git config user.name "github-actions" | ||
| git config user.email "[email protected]" | ||
| git tag ${{ steps.get-version.outputs.version }} | ||
| git push origin ${{ steps.get-version.outputs.version }} | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
|
|
||
| - name: Prepare release assets | ||
| if: github.ref_name == 'main' | ||
| run: | | ||
| mkdir -p release-assets | ||
| for dir in ./builds/*/; do | ||
| name=$(basename "$dir") | ||
| cp "$dir/vmlinux.bin" "release-assets/${name}.bin" | ||
| done | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| version_name=$(basename "$dir") | ||
| binary_path="$dir/firecracker" | ||
|
|
||
| - name: Upload Release Asset | ||
| if: github.ref_name == 'main' | ||
| uses: softprops/action-gh-release@v2 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| name: Firecrackers ${{ steps.get-version.outputs.version }} | ||
| tag_name: ${{ steps.get-version.outputs.version }} | ||
| files: "./release-assets/*" | ||
| echo "Processing $version_name..." | ||
|
|
||
| # Check if tag already exists | ||
| if git rev-parse "refs/tags/$version_name" >/dev/null 2>&1; then | ||
| echo "Tag $version_name already exists, skipping..." | ||
| continue | ||
| fi | ||
|
|
||
| # Check if release already exists | ||
| if gh release view "$version_name" >/dev/null 2>&1; then | ||
| echo "Release $version_name already exists, skipping..." | ||
| continue | ||
| fi | ||
|
|
||
| echo "Creating tag and release for $version_name..." | ||
|
|
||
| # Create and push tag | ||
| git tag "$version_name" | ||
| git push origin "$version_name" | ||
|
|
||
| # Create release with the binary | ||
| gh release create "$version_name" \ | ||
| --title "Firecracker $version_name" \ | ||
| --notes "Firecracker build: $version_name" \ | ||
| "$binary_path#${version_name}" | ||
| done | ||
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.