Skip to content

Split create_draft_release worfklow into hotfix / normal#7601

Merged
bouwkast merged 4 commits intomasterfrom
steven/split-draft-release
Nov 3, 2025
Merged

Split create_draft_release worfklow into hotfix / normal#7601
bouwkast merged 4 commits intomasterfrom
steven/split-draft-release

Conversation

@bouwkast
Copy link
Collaborator

@bouwkast bouwkast commented Oct 1, 2025

Summary of changes

This creates two new GitHub workflows: one to create a draft hotfix release and another to create a normal draft release.

Reason for change

During the recent hotfixes I accidentally ran the current create_draft_release workflow on the master branch (but it failed). If this would have succeeded we would have pushed the 3.27.0 artifacts to NuGet too soon when we just wanted to push 3.26.3 artifacts from that hotfix branch.

Splitting this helps prevent that from happening in the future.

Implementation details

  • .github/workflows/_create_draft_release.yml
    • This is a re-usable form of create_draft_release.yml - I copy/pasted that one. I'll paste below in "Other details" the diff between the files
  • .github/workflows/create_hotfix_draft_release.yml
    • Can only be run on hotfix/* branches
    • Skips doing anything with the vNext milestone (main difference)
    • Does everything that create_draft_release.yml would do if ran against a hotfix/ branch
  • .github/workflows/create_normal_draft_release.yml
    • Can only be run on master <- we can consider allowing others at a later point, but we don't have any other release lines that we currently support
    • Does everything that create_draft_release.yml would do if ran on master

Test coverage

None!

Other details

Note that I have NOT removed the current create_draft_release workflow. This is to ensure that when it comes time to release if these new workflows do not work that we won't be blocked. Testing workflows is always a bit challenging 🤷
I can try to see if this works in a fork though if that is desired :)

https://datadoghq.atlassian.net/browse/LANGPLAT-833

$ git diff --no-index .github/workflows/create_draft_release.yml .github/workflows/_create_draft_release.yml
diff --git a/.github/workflows/create_draft_release.yml b/.github/workflows/_create_draft_release.yml
index 4b17dab58..ba5280dbf 100644
--- a/.github/workflows/create_draft_release.yml
+++ b/.github/workflows/_create_draft_release.yml
@@ -1,14 +1,34 @@
-name: Create draft release
+name: Create reusable draft release

 on:
-  workflow_dispatch:
+  workflow_call:
     inputs:
       forced_commit_id:
         description: 'Force using artifacts from specific commit? If provided, this will try and use the artifacts from the given commit, regardless of build status'
         required: false
+        type: string
       ignore_gitlab_failures:
         description: "DANGER Force ignoring any issues with the GitLab artifacts or SSI. Don't use this unless you _really_ know what you're doing"
         required: false
+        type: boolean
+        default: false
+      is_hotfix:
+        description: 'Is this a hotfix release? If true, skips vNext milestone renaming'
+        required: true
+        type: boolean
+    secrets:
+      AZURE_DEVOPS_TOKEN:
+        required: true
+      NUGET_API_KEY:
+        required: true
+      GH_APP_ID:
+        required: true
+      GH_APP_PRIVATE_KEY:
+        required: true
+      DD_PREPROD_API_KEY:
+        required: true
+      DD_PUBLIC_SYMBOL_API_KEY:
+        required: true

 jobs:
   create_draft_release:
@@ -33,10 +53,10 @@ jobs:
       - name: Set SHA
         id: set_sha
         run: |
-          if [ -z "${{ github.event.inputs.forced_commit_id }}" ]; then
+          if [ -z "${{ inputs.forced_commit_id }}" ]; then
               commitsha="${GITHUB_SHA}"
           else
-              commitsha="${{ github.event.inputs.forced_commit_id }}"
+              commitsha="${{ inputs.forced_commit_id }}"
           fi
           echo "Using sha $commitsha"
           echo "sha=${commitsha}" >> $GITHUB_OUTPUT
@@ -78,7 +98,7 @@ jobs:
           private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}

       - name: "Check GitLab status"
-        if: ${{ !github.event.inputs.ignore_gitlab_failures }}
+        if: ${{ !inputs.ignore_gitlab_failures }}
         run: ./tracer/build.sh VerifyReleaseReadiness
         env:
           CommitSha: "${{ steps.set_sha.outputs.sha }}"
@@ -92,7 +112,7 @@ jobs:
         id: assets
         run: ./tracer/build.sh DownloadReleaseArtifacts
         env:
-          TargetBranch: ${{ github.event.ref }}
+          TargetBranch: ${{ github.ref }}
           CommitSha: "${{ steps.set_sha.outputs.sha }}"
           GITHUB_TOKEN: "${{ steps.generate-token.outputs.token }}"

@@ -105,7 +125,7 @@ jobs:
       - name: "Rename vNext milestone"
         id: rename
         # We don't rename vNext/vNext-v1 for hotfix releases
-        if: ${{ !contains(github.event.ref, 'hotfix') }}
+        if: ${{ !inputs.is_hotfix && !contains(github.ref, 'hotfix') }}
         run: ./tracer/build.sh RenameVNextMilestone
         env:
           Version: ${{steps.versions.outputs.full_version}}

@bouwkast bouwkast requested a review from a team as a code owner October 1, 2025 19:23
@github-actions github-actions bot added the area:builds project files, build scripts, pipelines, versioning, releases, packages label Oct 1, 2025
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

Copy link
Member

@andrewlock andrewlock left a comment

Choose a reason for hiding this comment

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

Thanks for doing this! And great call RE leaving the existing workflow in place

description: 'Is this a hotfix release? If true, skips vNext milestone renaming'
required: true
type: boolean
secrets:
Copy link
Member

Choose a reason for hiding this comment

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

TIL about secrets:

steps:
- name: Verify running on main release branch
run: |
if [[ "${{ github.ref }}" != "refs/heads/master" ]]; then
Copy link
Member

Choose a reason for hiding this comment

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

Technically we may need to do this from a "release" branch in the future too, but we can 100% deal with that if it comes to it

Comment on lines 127 to 128
# We don't rename vNext/vNext-v1 for hotfix releases
if: ${{ !inputs.is_hotfix && !contains(github.ref, 'hotfix') }}
Copy link
Member

Choose a reason for hiding this comment

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

Isn't the contains(github.ref, 'hotfix') superfluous? 🤔 Given we're explicitly providing a variable saying it's a hotfix, I think it might be better to just use that, otherwise the checks could get out of sync?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah that is a good point I can swap it to just using the is_hotfix

Initially my thought was just as a layer of extra protection, but yeah definitely see how this can cause it to be out of sync

@bouwkast bouwkast force-pushed the steven/split-draft-release branch from 0f09cdc to a18ef5e Compare October 23, 2025 13:23
@bouwkast bouwkast merged commit 3ed8cc2 into master Nov 3, 2025
98 of 101 checks passed
@bouwkast bouwkast deleted the steven/split-draft-release branch November 3, 2025 19:12
@github-actions github-actions bot added this to the vNext-v3 milestone Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:builds project files, build scripts, pipelines, versioning, releases, packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants