-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[VAULT-28762] Run Autopilot upgrade tests on main and PRs to main on …
…ENT if the AP code has changed (#28697) Co-authored-by: Josh Black <[email protected]>
- Loading branch information
1 parent
a94c8b8
commit 80729f0
Showing
6 changed files
with
279 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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 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 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,122 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: BUSL-1.1 | ||
|
||
--- | ||
name: Run Autopilot upgrade tests | ||
description: | | ||
This action runs the Autopilot upgrade tests on Vault Enterprise. | ||
It downloads the needed Vault Enterprise source version binaries from the releases page, checks out the specified ref | ||
from the Vault Enterprise repository, builds the target version binary of Vault for Autopilot upgrade testing, | ||
and runs the Autopilot upgrade tool with the specified source versions. | ||
inputs: | ||
checkout-ref: | ||
required: true | ||
type: string | ||
description: | | ||
The branch, tag, or SHA to checkout from the Vault Enterprise repository, e.g. 'refs/heads/main'. | ||
The target version binary of Vault for Autopilot upgrade testing will be built from this checkout. | ||
github-token: | ||
required: true | ||
type: string | ||
description: | | ||
The GitHub token to use for checking out the needed repositories. | ||
source-versions: | ||
required: true | ||
type: string | ||
description: | | ||
The source versions of Vault for Autopilot upgrade testing as a comma-separated string, | ||
e.g. '1.16.9+ent,1.17.7+ent,1.18.0+ent'. | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Authenticate to Vault | ||
id: vault-auth | ||
shell: bash | ||
run: vault-auth | ||
- name: Fetch Secrets | ||
id: secrets | ||
uses: hashicorp/vault-action@d1720f055e0635fd932a1d2a48f87a666a57906c # v3.0.0 | ||
with: | ||
url: ${{ steps.vault-auth.outputs.addr }} | ||
caCertificate: ${{ steps.vault-auth.outputs.ca_certificate }} | ||
token: ${{ steps.vault-auth.outputs.token }} | ||
secrets: | | ||
kv/data/github/${{ github.repository }}/github-token username-and-token | github-token; | ||
kv/data/github/${{ github.repository }}/license license_1 | VAULT_LICENSE_CI; | ||
kv/data/github/${{ github.repository }}/license license_2 | VAULT_LICENSE_2; | ||
- name: Setup Git configuration (private) | ||
id: setup-git-private | ||
if: github.repository == 'hashicorp/vault-enterprise' | ||
shell: bash | ||
run: | | ||
git config --global url."https://${{ steps.secrets.outputs.github-token }}@github.com".insteadOf https://github.com | ||
- name: Check out the .release/versions.hcl file from Vault Enterprise repository | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
with: | ||
ref: ${{ inputs.checkout-ref }} | ||
- uses: ./.github/actions/set-up-go | ||
with: | ||
github-token: ${{ inputs.github-token }} | ||
- name: Build external tools | ||
uses: ./.github/actions/install-external-tools | ||
- name: Checkout VCM repository | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
with: | ||
repository: hashicorp/vcm | ||
token: ${{ inputs.github-token }} | ||
path: vcm | ||
- name: Checkout Vault tools repository to get the Autopilot upgrade tool | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
with: | ||
repository: hashicorp/vault-tools | ||
token: ${{ inputs.github-token }} | ||
path: vault-tools | ||
- name: Install needed Vault versions | ||
env: | ||
GOPATH: /home/runner/go | ||
shell: bash | ||
run: | | ||
# Split the matched versions into an array | ||
IFS=',' read -r -a versions <<< "${{ inputs.source-versions }}" | ||
for version in "${versions[@]}"; do | ||
echo "Installing Vault version $version" | ||
"${GITHUB_WORKSPACE}/vault-tools/vvm/vvm" install-ent "${version}" | ||
done | ||
- name: Build dev binary for binary tests | ||
env: | ||
GOPATH: /home/runner/go | ||
GOPRIVATE: github.com/hashicorp/* | ||
shell: bash | ||
run: | | ||
cd "${GITHUB_WORKSPACE}" || exit 1 | ||
time make prep dev | ||
# Save the binary we just build under the current Vault version number to VVM | ||
# for apupgrade to use as a target version | ||
current_version=$(cat version/VERSION) | ||
"${GITHUB_WORKSPACE}/vault-tools/vvm/vvm" save "${current_version}" | ||
echo "VAULT_TARGET_VERSION=${current_version}" >> "${GITHUB_ENV}" | ||
- name: Build VCM | ||
shell: bash | ||
run: | | ||
cd "${GITHUB_WORKSPACE}/vcm" || exit 1 | ||
make | ||
- name: Build Autopilot upgrade tool | ||
shell: bash | ||
run: | | ||
cd "${GITHUB_WORKSPACE}/vault-tools/apupgrade" || exit 1 | ||
go build -o apupgrade . | ||
- name: Run Autopilot upgrade tool | ||
shell: bash | ||
run: | | ||
# Write the license to a file for VCM to use | ||
echo "${{ steps.secrets.outputs.VAULT_LICENSE_CI }}" > "${GITHUB_WORKSPACE}/license.hclic" | ||
export VAULT_LICENSE_PATH="${GITHUB_WORKSPACE}/license.hclic" | ||
# Unset VAULT_ADDR to avoid any conflicts with VCM and apupgrade | ||
unset VAULT_ADDR | ||
echo "Running Autopilot upgrade tool with source versions: ${{ inputs.source-versions }} and target version: ${{ env.VAULT_TARGET_VERSION }}" | ||
"${GITHUB_WORKSPACE}/vault-tools/apupgrade/apupgrade" -versions "${{ inputs.source-versions }},${VAULT_TARGET_VERSION}" -use-vvm |
This file contains 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,62 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: BUSL-1.1 | ||
|
||
--- | ||
name: Set up sqlc from Github releases | ||
description: Set up sqlc from Github releases | ||
|
||
inputs: | ||
destination: | ||
description: "Where to install the sqlc binary (default: $HOME/bin/sqlc)" | ||
type: string | ||
default: "$HOME/bin/sqlc" | ||
version: | ||
description: "The version to install (default: latest)" | ||
type: string | ||
default: Latest | ||
|
||
outputs: | ||
destination: | ||
description: Where the installed sqlc binary is | ||
value: ${{ steps.install.outputs.destination }} | ||
destination-dir: | ||
description: The directory where the installed sqlc binary is | ||
value: ${{ steps.install.outputs.destination-dir }} | ||
version: | ||
description: The installed version of sqlc | ||
value: ${{ steps.install.outputs.version }} | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- id: install | ||
shell: bash | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: | | ||
VERSION=$(./.github/scripts/retry-command.sh gh release list -R sqlc-dev/sqlc --exclude-drafts --exclude-pre-releases | grep ${{ inputs.version }} | cut -f1) | ||
mkdir -p $(dirname ${{ inputs.destination }}) | ||
DESTINATION="$(readlink -f "${{ inputs.destination }}")" | ||
DESTINATION_DIR="$(dirname "$DESTINATION")" | ||
echo "$DESTINATION_DIR" >> "$GITHUB_PATH" | ||
{ | ||
echo "destination=$DESTINATION" | ||
echo "destination-dir=$DESTINATION_DIR" | ||
echo "version=$VERSION" | ||
} | tee -a "$GITHUB_OUTPUT" | ||
ARCH="$(echo "$RUNNER_ARCH" | tr '[:upper:]' '[:lower:]')" | ||
OS="$(echo "$RUNNER_OS" | tr '[:upper:]' '[:lower:]')" | ||
if [ "$ARCH" = "x64" ]; then | ||
export ARCH="amd64" | ||
fi | ||
if [ "$OS" = "macos" ]; then | ||
export OS="darwin" | ||
fi | ||
./.github/scripts/retry-command.sh gh release download "$VERSION" --clobber -p "sqlc*_${OS}_${ARCH}.zip" -O sqlc.zip -R sqlc-dev/sqlc | ||
unzip sqlc.zip | ||
chmod +x sqlc | ||
mv sqlc "$DESTINATION" |
This file contains 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 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