Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
c0b2361
Change the release workflow to run mixed mode tests in parallel
ScottDugas Mar 4, 2025
65b5f09
Fix job dependency
ScottDugas Mar 4, 2025
2e71815
Checkout the sources in the workflow
ScottDugas Mar 5, 2025
e14d4e2
Fix path to release-test action
ScottDugas Mar 5, 2025
e915734
Pass mixed mode results to publish to put in release notes
ScottDugas Mar 5, 2025
74ea54b
Fix path to actions/release-publish
ScottDugas Mar 5, 2025
76fad40
Need to include the shell for run commands
ScottDugas Mar 5, 2025
1a2bb08
Correctly format GITHUB_OUTPUT for mixed_mode_results
ScottDugas Mar 5, 2025
799cf0d
Put mixed mode results in step summary too
ScottDugas Mar 5, 2025
e4f602c
Add missing shells to release-publish/action.yml
ScottDugas Mar 5, 2025
835ed7e
Put mixed-mode results in a file
ScottDugas Mar 5, 2025
aedf1be
Fix comment about deploy_docs
ScottDugas Mar 5, 2025
22785f9
Use single quote characters for markdown argument
ScottDugas Mar 5, 2025
5f43c4e
Use artifacts to pass mixed mode results between jobs
ScottDugas Mar 5, 2025
aafbe6b
Switch to uploading a directory
ScottDugas Mar 5, 2025
bad0a92
Forgot to update one path to be a subdirectory
ScottDugas Mar 5, 2025
d315c83
Move uploading and downloading of artifacts to workflow
ScottDugas Mar 5, 2025
f508c37
Use current version of download-artifact
ScottDugas Mar 5, 2025
2707033
Try printing contents of artifact.tar
ScottDugas Mar 5, 2025
7863f24
Extract the downloaded artifact.tar
ScottDugas Mar 5, 2025
a6f2632
Insert mixed mode results when updating release notes
ScottDugas Mar 5, 2025
92a08bd
Forgot a missing backslash
ScottDugas Mar 5, 2025
a96bdd5
Remove some debug logging
ScottDugas Mar 6, 2025
585d864
Log github.ref
ScottDugas Mar 6, 2025
8f7128f
Calculate update type based on target ref
ScottDugas Mar 6, 2025
d53bde2
Fix semicolons
ScottDugas Mar 6, 2025
8752ce6
Close missing parentheses
ScottDugas Mar 6, 2025
de586ec
Log context and github
ScottDugas Mar 6, 2025
c90c577
Use context.ref instead of github.ref in the script
ScottDugas Mar 6, 2025
41960d7
Fix one more reference to github.ref
ScottDugas Mar 6, 2025
ff3ff22
It's "refs/heads/" not "refs/head/"
ScottDugas Mar 6, 2025
02821f5
Specify update-type as output
ScottDugas Mar 6, 2025
a63c022
Pass update type to places that use it
ScottDugas Mar 6, 2025
2509363
Fix typo
ScottDugas Mar 6, 2025
e72902f
Add back extracting the mixed mode results from artifact
ScottDugas Mar 6, 2025
a8085db
Do not update documentation on patch releases
ScottDugas Mar 6, 2025
3ac9d74
Don't use the ${{}} in if clauses
ScottDugas Mar 6, 2025
0f14758
Use single quote characters in if clauses
ScottDugas Mar 6, 2025
d9840da
Re-enable publishing the artifacts
ScottDugas Mar 7, 2025
0fb2c6a
Cleanup old patch_release
ScottDugas Mar 7, 2025
7af05e0
Remove unused changed to publish-mixed-mode-results.py
ScottDugas Mar 7, 2025
003a081
Remove outdated TODOs and add more comments
ScottDugas Mar 7, 2025
cfc1cd6
Remove separate workflow for generating mixed mode test results
ScottDugas Mar 7, 2025
a2d2685
Remove unnecessary mixed_mode_results input for release-publish
ScottDugas Mar 7, 2025
de3dd17
Put publishing artifacts back where it belongs
ScottDugas Mar 7, 2025
141f2b8
Remove outdated TODO
ScottDugas Mar 7, 2025
07f0f64
Remove unnecessary dependency on get-update-type
ScottDugas Mar 7, 2025
44696ab
Use upload-artifacts instead of upload-pages-artifacts
ScottDugas Mar 7, 2025
9bba7a9
Inline the fairly small release-test action
ScottDugas Mar 7, 2025
67966fa
Inline release specific actions
ScottDugas Mar 7, 2025
1ffcc6e
Remove MIXED_MODE_RESULTS PLACEHOLDER
ScottDugas Mar 7, 2025
a624266
Have publish-mixed-mode-results.py output to a file
ScottDugas Mar 7, 2025
b33b6a0
Set GH_TOKEN when updating release notes
ScottDugas Mar 7, 2025
6545587
Fix patch_release.yml
ScottDugas Mar 7, 2025
e36067c
Add mixed-mode-results.md to .gitignore
ScottDugas Mar 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 0 additions & 46 deletions .github/workflows/mixed_mode_test.yml

This file was deleted.

40 changes: 4 additions & 36 deletions .github/workflows/patch_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,10 @@ on:
description: 'Branch to build off of'
required: true


jobs:
gradle:
no-op:
runs-on: ubuntu-latest
permissions:
checks: write
contents: write
packages: write
pages: read
pull-requests: write
steps:
- name: Checkout sources
uses: actions/checkout@v4.2.2
with:
ref: ${{ inputs.branch }}
ssh-key: ${{ secrets.DEPLOY_KEY }}
fetch-tags: true
# fetch all the history to make sure that we have the last release
# I tried fetching part of the history, but I just couldn't get it to work, and fetching all still takes like 5s
fetch-depth: 0
- name: Setup Base Environment
uses: ./actions/setup-base-env
- name: Setup FDB
uses: ./actions/setup-fdb
- name: Configure Git
run: |
git config --global user.name 'FoundationDB CI'
git config --global user.email 'foundationdb_ci@apple.com'

- name: Build and publish release
uses: ./actions/release-build-publish
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
update_type: PATCH
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
- name: Show message
shell: bash
run: echo "Patch releases are now done via the release job just against a non-main branch"
230 changes: 214 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,110 @@ name: Release
on:
workflow_dispatch:


jobs:
gradle:
# 1. We look at the target branch and figure out whether this should be a BUILD
# release or a patch release
get-update-type:
# If the context.ref is refs/heads/main we want to do a standard release
# If the context.ref is refs/heads/* we want to do a patch release
# If the context.ref is some other ref, we want to fail
# Selecting a tag github.ref becomes e.g.: refs/tags/4.1.9.0
runs-on: ubuntu-latest
permissions:
contents: read
outputs: # This means this can later be referenced with needs.get-update-type.outputs.update-type
update-type: ${{ steps.update-type.outputs.result }}
steps:
- name: Calculate update type
uses: actions/github-script@v7
id: update-type
with:
script: |
if (context.ref == "refs/heads/main") {
return "BUILD";
} else if (context.ref.startsWith("refs/heads/")) {
return "PATCH";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One consequence of this approach is that if someone runs a patch build, they use the patch process that is baked into their branch, rather than the one on main. In some ways, that's good, because it means that if there's a relatively stable release process in a past branch, then past builds will continue to use that. But it also means that we need to be a little mindful of keeping past patch branches up to date if there are any changes that need to be reflected everywhere. Overall, this is probably fine, and there was actually already some dependency between the different branches (as any of the composite actions would borrow the version from the branch), but I did want to raise this nonetheless

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, It used to be that you could select a different branch for the workflow, vs the branch that you are releasing.
So that was strictly more flexible.
As you note, the composite actions would always chose from the branch being released.

We could definitely add a branch input that allows you to use the workflow from one branch, and release a different branch, but it seems rather delicate, and we'd be better off not doing it right now, and seeing how a branch release goes. We can always backport any workflow changes to the other branch.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also kind of looks like my patch release may be messing with the workflows in general, which seems super weird.
It, all of a sudden, has 5 runs, and all of them say it's invalid: https://github.com/FoundationDB/fdb-record-layer/actions/workflows/patch_release.yml
I fixed the issue (I think), but nothing happened after that.

} else {
throw new Error("Target must be a patch branch or main, but was: " + context.ref);
}
result-encoding: string
- name: Print update type
shell: bash
run: echo "${{steps.update-type.outputs.result}}"

# 2. In parallel, we run:
# a) all the tests
# b) the mixed-mode tests
Comment thread
alecgrieser marked this conversation as resolved.
test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout sources
uses: actions/checkout@v4.2.2
- name: Setup Base Environment
id: setup-base
uses: ./actions/setup-base-env
- name: Setup FDB
uses: ./actions/setup-fdb
- name: Run Gradle Test
uses: ./actions/gradle-test
with:
gradle_args: -PreleaseBuild=true -PpublishBuild=true

# 2. b) We run the mixed mode tests
mixed-mode-test:
needs: [get-update-type]
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout sources
uses: actions/checkout@v4.2.2
- name: Setup Base Environment
uses: ./actions/setup-base-env
- name: Setup FDB
uses: ./actions/setup-fdb
- name: Run Gradle Test
uses: ./actions/gradle-test
with:
gradle_command: mixedModeTest
gradle_args: -PreleaseBuild=false -PpublishBuild=false
# We don't commit the incremented version, but we use this to know the version when generating
# the resulting markdown
- name: Increment version
shell: bash
run: python build/versionutils.py gradle.properties --increment -u ${{ needs.get-update-type.outputs.update-type }}
- name: Get new version
id: get_new_version
shell: bash
run: |
echo "version=$(python build/versionutils.py gradle.properties)" >> "$GITHUB_OUTPUT"
- name: Create markdown
shell: bash
run: python build/publish-mixed-mode-results.py ${{ steps.get_new_version.outputs.version }} --run-link ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} --output mixed-mode-results.md
- name: Preview results
shell: bash
run: cat mixed-mode-results.md >> $GITHUB_STEP_SUMMARY
# I think this _needs_ to be done at this level, rather than in the action
# so that "mixed-mode-results" gets passed around correctly
- name: Upload mixed mode results
id: mixed_mode_results
uses: actions/upload-artifact@v4.6.0
with:
name: mixed-mode-results
path: mixed-mode-results.md
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should consider adding mixed-mode-results.md to the .gitignore, or placing it in a directory that is already excluded. The way the PR creating workflow works, if there are files that aren't in the .gitignore present, it will include them in the PR that it creates. Excluding the file would make sure that we don't accidentally do that, particularly in the other step when we download it.


# 3. Update the version in the repo, update the release notes, tag the commit
# and publish the artifacts, and if this is a BUILD release generate the documentation
publish:
needs: [test, mixed-mode-test, get-update-type]
runs-on: ubuntu-latest
permissions:
checks: write
contents: write
packages: write
pull-requests: write
pull-requests: write # We create a pull request if committing the release notes updates fails
steps:
- name: Checkout sources
uses: actions/checkout@v4.2.2
Expand All @@ -20,52 +116,154 @@ jobs:
# fetch all the history to make sure that we have the last release
# I tried fetching part of the history, but I just couldn't get it to work, and fetching all still takes like 5s
fetch-depth: 0
- name: Setup Base Environment
id: setup-base
uses: ./actions/setup-base-env
- name: Setup FDB
uses: ./actions/setup-fdb

- name: Configure git
shell: bash
run: |
git config --global user.name 'FoundationDB CI'
git config --global user.email 'foundationdb_ci@apple.com'

- name: Build and publish
uses: ./actions/release-build-publish

- name: Setup Base Environment
uses: ./actions/setup-base-env
- name: Get old version
id: get_old_version
shell: bash
run: |
echo "version=$(python build/versionutils.py gradle.properties)" >> "$GITHUB_OUTPUT"
# Push a version bump back to main. There are failure scenarios that can result
# in published artifacts but an erroneous build, so it's safer to bump the version
# at the beginning
- name: Increment version
shell: bash
run: python build/versionutils.py gradle.properties --increment --commit -u ${{ needs.get-update-type.outputs.update-type }}
- name: Get new version
id: get_new_version
shell: bash
run: |
echo "version=$(python build/versionutils.py gradle.properties)" >> "$GITHUB_OUTPUT"
# We also want to push the tag, because that will be used for the next release's release notes
- name: Create tag
shell: bash
run: git tag -m "Release ${{ steps.get_new_version.outputs.version }}" -f "${{ steps.get_new_version.outputs.version }}"

# We want to do this before anything else, because if the later steps fail, we want to make sure that the full
# change log includes all changes, even if they reference a release that was never actually published.
- name: Download mixed mode results
uses: actions/download-artifact@v4
with:
name: mixed-mode-results
- name: echo results
shell: bash
run: cat mixed-mode-results.md || ls
- name: Update release notes
shell: bash
run: |
python ./build/create_release_notes.py \
--config ./build/release-notes-config.json \
--release-notes-md docs/sphinx/source/ReleaseNotes.md \
--skip-commit $(git log -n 1 --format=%H HEAD) \
--repository ${{ github.repository }} \
--commit \
--mixed-mode-results mixed-mode-results.md \
${{ steps.get_old_version.outputs.version }} ${{ steps.get_new_version.outputs.version }}
env:
GH_TOKEN: ${{ github.token }}
# We move the tag to after the release notes are updated so that later steps (i.e. sphinx) will pick up the udpated
# release notes
- name: Move tag to HEAD
shell: bash
run: git tag -m "Release ${{ steps.get_new_version.outputs.version }}" -f "${{ steps.get_new_version.outputs.version }}"

# push the changes to gradle.properties, the release notes, and the tag as one operation, so if it fails,
# it will be as if the release never did anything
- name: Push Version Update
shell: bash
run: git push origin HEAD "${{ steps.get_new_version.outputs.version }}"

- name: Publish Artifacts
uses: ./actions/run-gradle
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
update_type: BUILD
gradle_command: publish closeAndReleaseStagingRepositories -PreleaseBuild=true -PpublishBuild=true -PgithubPublish=true -PcentralPublish=true
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSPHRASE }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}

# Post release: Update various files which reference version
# Updating the yaml files has to be done after the tests complete, or it will mark tests as failing that aren't
# supported by the previous version.
- name: Update YAML test file versions
uses: ./actions/run-gradle
with:
gradle_command: updateYamsql -PreleaseBuild=true
- name: Commit YAML updates
shell: bash
run: python ./build/commit_yamsql_updates.py "${{ steps.get_new_version.outputs.version }}"
- name: Push Updates
id: push_updates
shell: bash
run: git push origin
# Continue the build (including downstream steps). If the push fails, we'll create a PR
continue-on-error: true
- name: Create Merge PR if conflict
# Only create the PR if we've otherwise been successful, but the push failed. Note that
# we're checking the .outcome of the push step, which is applied before continue-on-error.
if: success() && steps.push_updates.outcome == 'failure'
uses: peter-evans/create-pull-request@bb88e27d3f9cc69c8bc689eba126096c6fe3dded
id: pr_on_conflict
with:
branch: release-build
branch-suffix: timestamp
title: "Updates for ${{ steps.get_new_version.outputs.version }} release"
sign-commits: true
body: |
Updates from release for version ${{ steps.get_new_version.outputs.version }}. Conflicts during the build prevented automatic updating. Please resolve conflicts by checking out the current branch, merging, and then deleting this branch.

# Creating the PR can change the current branch. Explicitly check out the tag here for downstream builds
- name: Revert to tag
shell: bash
run: git checkout "${{ steps.get_new_version.outputs.version }}"

# Build documentation.
# Build documentation (We don't do any of the remaining steps for patch releases)
- name: LOG update type
shell: bash
run: echo "${{ needs.get-update-type.outputs.update-type }}"
- name: Cache Python Environment
if: needs.get-update-type.outputs.update-type == 'BUILD'
uses: actions/cache@v4
with:
path: docs/sphinx/.venv
key: ${{ runner.os }}-sphinx-python-${{ steps.setup-base.outputs.python-version }}-${{ hashFiles('docs/sphinx/requirements.txt') }}
- name: Build Documentation Site
if: needs.get-update-type.outputs.update-type == 'BUILD'
uses: ./actions/run-gradle
with:
gradle_command: documentationSite -PreleaseBuild=true
- name: Upload Documentation
if: needs.get-update-type.outputs.update-type == 'BUILD'
id: doc_upload
uses: actions/upload-pages-artifact@v3
with:
path: docs/sphinx/.out/html/

# 4. We deploy the documentation from (3) to github pages, unless this is a patch release
# deploy_docs is a separate job so that it can run with different permissions from
# everything else, but it depends on publish so, it will always run last
deploy_docs:
runs-on: ubuntu-latest
needs: gradle
needs: [publish]
if: needs.get-update-type.outputs.update-type == 'BUILD'
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.doc_upload.outputs.page_url }}
steps:
- name: LOG update type
shell: bash
run: echo "${{ needs.get-update-type.outputs.update-type }}"
- name: Deploy Documentation
uses: actions/deploy-pages@v4
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,6 @@ run/

# Token files required for parsing Antlr files correctly in the IDE
fdb-relational-core/src/main/antlr/*.tokens

# output during release build process
/mixed-mode-results.md
Loading