Skip to content
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

#3 Added aiSSEMBLE GitHub Action release job #332

Merged
merged 1 commit into from
Sep 13, 2024
Merged

Conversation

jacksondelametter
Copy link
Contributor

This is a PR to add the aiSSEMBLE GitHub Action release job. This action mimics the Jenkins release job found here https://github.boozallencsn.com/aissemble/aissemble/blob/fix-ci/devops/JenkinsfileRelease.groovy

The release job aims to do the following

  • Parses the inputted version to get its major, minor, and patch counterparts
  • Executes a pre release update to the release branch's Antora documentation
  • Cuts a release of the release branch
  • Executes a post release update to the release branch's Antora documentation


runs-on: arc-runner-set-aissemble
env:
DOCKER_CONFIG: /home/runner/.docker
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using env variables to easily switch out using workflow_dispatch input values and hardcoded values for testing!

description: "OPTIONAL: The existing aiSSEMBLE version. Defaults to patchVersion-SNAPSHOT"
required: false
type: string
dryRun:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Allows us to toggle running the release job in dryRun mode.

Copy link
Contributor

@aaron-gary aaron-gary left a comment

Choose a reason for hiding this comment

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

Looks good to me, but I haven't done a release on aiSSEMBLE so be sure you get a second opinion from baseline.

Also, be sure to sign all commits.

with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: actions/checkout@v4
Copy link
Contributor

@carter-cundiff carter-cundiff Sep 13, 2024

Choose a reason for hiding this comment

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

Q: - uses: actions/checkout@v4 this is used twice, is that needed? Also on line 106.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it is needed, it is a bug with using custom actions. You have to checkout the current branch your running on for them to show up. The other checkout checks out the release branch.

Copy link
Contributor

Choose a reason for hiding this comment

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

Recommend grouping them together (if possible) and leaving a comment explaining that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I cant group them unfortunately but I can leave a comment

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you'll need a double checkout once this is merged to dev. Do you have a link to the info you found saying you would need that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok this is actually not a bug. It looks like if you dont do a initial checkout, the local aissemble repository is actually not present in the runner. By doing an initial checkout, the repository is present and the branch being ran on is checked out.

description: 'Existing version'
required: true
outputs:
minor-version:
Copy link
Contributor

Choose a reason for hiding this comment

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

S: Would update this variable to be major-minor-version, sort of misleading currently.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed

description: "Is pre-release version"
value: ${{ steps.split.outputs.release-branch }}
existing-version:
description: "Is pre-release version"
Copy link
Contributor

Choose a reason for hiding this comment

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

S: Update descriptions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

echo "minor-version=$minor_version" >> $GITHUB_OUTPUT
echo "patch-version=$patch_version" >> $GITHUB_OUTPUT
echo "is-pre-release=$( [ "${{ inputs.version }}" != "$patch_version" ] && echo true || echo false)" >> $GITHUB_OUTPUT
echo "release-branch=$( [ "${{ inputs.releaseBranch }}" != "" ] && echo "${{ inputs.releaseBranch }}" || echo "aissemble-release-$minor_version")" >> $GITHUB_OUTPUT
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: Have you verified this works having the echo and part of the && conditional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes this works!

custom-facet-new-version: ${{ env.RELEASE_VERSION }}
- name: Create settings.xml
run: |
echo "<settings><servers><server><id>ossrh</id><username>${{ secrets.SONATYPE_CENTRAL_REPO_TOKEN_USER }}</username><password>${{ secrets.SONATYPE_CENTRAL_REPO_TOKEN_KEY }}</password></server><server><id>ghcr.io</id><username>${{ secrets.GHCR_IO_USERNAME }}</username><password>${{ secrets.GHCR_IO_TOKEN }}</password></server><server><id>pypi</id><username>${{ secrets.PYPI_USERNAME }}</username><password>${{ secrets.PYPI_TOKEN }}</password></server><server><id>dev-pypi</id><username>${{ secrets.TEST_PYPI_USERNAME }}</username><password>${{ secrets.TEST_PYPI_TOKEN }}</password></server> </servers></settings>" > $HOME/.m2/settings.xml
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: Should we be using a differ pypi server for the release? I believe test pypi is only for our snapshots.

Copy link
Contributor Author

@jacksondelametter jacksondelametter Sep 13, 2024

Choose a reason for hiding this comment

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

Its being uploaded to Pypi not test pypi, I verified this. We add in credentials to Pypi and test Pypi

Copy link
Contributor

Choose a reason for hiding this comment

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

Safe to remove this then? <id>dev-pypi</id><username>${{ secrets.TEST_PYPI_USERNAME }}</username><password>${{ secrets.TEST_PYPI_TOKEN }}</password>?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure if it is safe to remove!

Copy link
Contributor

Choose a reason for hiding this comment

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

yes it should be

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

minor=$(echo ${{ inputs.version }} | cut -d "." -f 2)
patch=$(echo ${{ inputs.version }} | cut -d "." -f 3 | cut -d "-" -f 1)
minor_version=$major.$minor
patch_version=$major.$minor.$patch
Copy link
Contributor

Choose a reason for hiding this comment

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

A: Would be helpful to have comments explaining what these vars are given inputs, for example from the old release script:

//grab second group (first embedded capture) in first match: 1.4.2-rc.3 -> 1.4.2

//grab second group (first embedded capture) in first match: 1.4.2 -> 1.4

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added comments to better explain

run: |
echo "Releasing with the following parameters"
echo "Release version: ${{ env.RELEASE_VERSION }}"
echo "Development version: ${{ env.DEVELOPMENT_VERSION }}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Optional: Change Development version -> Next Development Version and env.DEVELOPMENT_VERSION -> env.NEXT_DEVELOPMENT_VERSION

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed

@jacksondelametter jacksondelametter force-pushed the 3-add-release branch 2 times, most recently from 98aae12 to 0b93383 Compare September 13, 2024 14:21
default: false
type: boolean
push:
branches: [ "3-add-release" ]
Copy link
Contributor

Choose a reason for hiding this comment

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

This will be removed before merge? Does it need a different value?

Copy link
Contributor

Choose a reason for hiding this comment

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

C: This needs to be removed before merging. This workflow should be on dispatch only.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is only for testing purposes. It will be removed before being merged.

@jacksondelametter jacksondelametter force-pushed the 3-add-release branch 2 times, most recently from 7866381 to d7eb15d Compare September 13, 2024 15:15
description: "Is pre-release version"
value: ${{ steps.split.outputs.is-pre-release }}
release-branch:
description: "Is pre-release version"
Copy link
Contributor

Choose a reason for hiding this comment

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

A: Update description

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed descriptions

required: true
outputs:
major-minor-version:
description: "Major-minor version"
Copy link
Contributor

Choose a reason for hiding this comment

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

S: In general these descriptions are just restating the name of the output which doesn't seem helpful. We should either make them more explanatory or just omit them if we can.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed descriptions

release-branch:
description: 'Release branch'
required: true
custom-facet-old-version:
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: Why are these inputs instead of just being derived from version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When updating the custom facet schemas, what we change differs between the pre release Antora docs update and the post release.

git config --global user.name "aiSSEMBLE Team"
git diff
git add .
git commit -S -m "Updating scripts and templates to ${{ inputs.version }}"
Copy link
Contributor

Choose a reason for hiding this comment

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

A: I'd make the commit message more accurate. This is likely a carryover from when we updated more stuff manually instead of through the build process.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to "Updating Antora documentation to version ..."

NEXT_DEVELOPMENT_VERSION: ${{ inputs.developmentVersion || '1.10.0-SNAPSHOT' }}
RELEASE_BRANCH: ${{ inputs.releaseBranch }}
EXISTING_VERSION: ${{ inputs.existingVersion }}
DRY_RUN: ${{ inputs.dryRun || true }}
Copy link
Contributor

Choose a reason for hiding this comment

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

C: We should not be including these defaults at all. It just introduces risk/confusion. If this script is updated/worked on in the future and such mechanisms are helpful, the author can add this stuff in. However, I would argue that we should be testing by filling in the parameters manually anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is only for testing purposes. This will be deleted before being merged.

curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
- name: Install Helm Unittest Plugin
Copy link
Contributor

Choose a reason for hiding this comment

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

S: This is just a copy of what we're doing in build.yaml right? Strongly suggest we pull these out into a common place if so. We're already introducing the complexity of composite actions, and this is the core use case for them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added instal dependencies composite action.

echo "<settings><servers><server><id>ossrh</id><username>${{ secrets.SONATYPE_CENTRAL_REPO_TOKEN_USER }}</username><password>${{ secrets.SONATYPE_CENTRAL_REPO_TOKEN_KEY }}</password></server><server><id>ghcr.io</id><username>${{ secrets.GHCR_IO_USERNAME }}</username><password>${{ secrets.GHCR_IO_TOKEN }}</password></server><server><id>pypi</id><username>${{ secrets.PYPI_USERNAME }}</username><password>${{ secrets.PYPI_TOKEN }}</password></server><server><id>dev-pypi</id><username>${{ secrets.TEST_PYPI_USERNAME }}</username><password>${{ secrets.TEST_PYPI_TOKEN }}</password></server> </servers></settings>" > $HOME/.m2/settings.xml
- name: Release aiSSEMBLE
run: |
./mvnw release:clean release:prepare release:perform -s $HOME/.m2/settings.xml -U -B -Pci,gh-build -DdryRun=${{ env.DRY_RUN }} -DpushChanges=true -DreleaseVersion=${{ env.RELEASE_VERSION }} -DdevelopmentVersion=${{ env.NEXT_DEVELOPMENT_VERSION }} [email protected] -DsignTag=true -Dmaven.build.cache.enabled=false
Copy link
Contributor

Choose a reason for hiding this comment

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

S: IMO the dry-run isn't going to be used enough to warrant having it checked in to dev and it just adds noise to the parameters. Esp since we aren't using it for things like the git commits at earlier steps.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

carter-cundiff added a commit that referenced this pull request Sep 13, 2024
- Update documentation to live under supporting components
- #219 improve manual action message keys
@jacksondelametter jacksondelametter merged commit 689c412 into dev Sep 13, 2024
@jacksondelametter jacksondelametter deleted the 3-add-release branch September 13, 2024 18:28
carter-cundiff added a commit that referenced this pull request Sep 13, 2024
- Update documentation to live under supporting components
- #219 improve manual action message keys
carter-cundiff added a commit that referenced this pull request Sep 13, 2024
- Update documentation to live under supporting components
- #219 improve manual action message keys
carter-cundiff added a commit that referenced this pull request Sep 16, 2024
- Update documentation to live under supporting components
- #219 improve manual action message keys
carter-cundiff added a commit that referenced this pull request Sep 16, 2024
- Update documentation to live under supporting components
- #219 improve manual action message keys
carter-cundiff added a commit that referenced this pull request Sep 16, 2024
- Update documentation to live under supporting components
- #219 improve manual action message keys
carter-cundiff added a commit that referenced this pull request Sep 16, 2024
- Update documentation to live under supporting components
- #219 improve manual action message keys
carter-cundiff added a commit that referenced this pull request Sep 16, 2024
- Update documentation to live under supporting components
- #219 improve manual action message keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants