-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: test against n-2 versions of Vault (#604)
- Loading branch information
Showing
6 changed files
with
227 additions
and
78 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
name: Integration test | ||
description: Run the integration tests against a single version of k8s and Vault | ||
inputs: | ||
k8s-version: | ||
description: 'Kubernetes version to use for the kind cluster' | ||
required: true | ||
version: | ||
description: 'Vault K8s version to use for the tests' | ||
required: true | ||
vault-version: | ||
description: 'Vault version to use for the tests' | ||
required: true | ||
tarball-file: | ||
description: 'Name of the tarball file artifact to download' | ||
required: true | ||
kind-cluster-name: | ||
description: 'Name of the kind cluster to create and test against' | ||
default: 'vault-k8s' | ||
bats-version: | ||
description: 'Version of bats to run tests with' | ||
default: '1.11.0' | ||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | ||
- run: sudo npm install -g bats@${{ inputs.bats-version }} | ||
shell: bash | ||
- run: bats -v | ||
shell: bash | ||
|
||
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 | ||
with: | ||
python-version: '3.10' | ||
- run: pip install yq | ||
shell: bash | ||
|
||
# Checkout this repo. | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
with: | ||
path: "vault-k8s" | ||
|
||
# Checkout vault-helm for acceptance test code. | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
with: | ||
repository: "hashicorp/vault-helm" | ||
ref: "v0.27.0" | ||
path: "vault-helm" | ||
|
||
- name: Create Kind Cluster | ||
uses: helm/kind-action@99576bfa6ddf9a8e612d83b513da5a75875caced # v1.9.0 | ||
with: | ||
cluster_name: ${{ inputs.kind-cluster-name }} | ||
config: vault-helm/test/kind/config.yaml | ||
node_image: kindest/node:v${{ inputs.k8s-version }} | ||
version: "v0.22.0" | ||
|
||
- name: Create kind export log root | ||
id: create_kind_export_log_root | ||
shell: bash | ||
run: | | ||
vault_flavor=community | ||
log_artifact_name="kind-${{ inputs.kind-cluster-name }}-$(git rev-parse --short ${{ github.sha }})-${{ inputs.k8s-version }}-${{ inputs.vault-version }}-${vault_flavor}-helm-logs" | ||
log_root="/tmp/${log_artifact_name}" | ||
mkdir -p "${log_root}" | ||
echo "log_root=${log_root}" >> $GITHUB_OUTPUT | ||
echo "log_artifact_name=${log_artifact_name}" >> $GITHUB_OUTPUT | ||
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | ||
with: | ||
name: ${{ inputs.tarball-file }} | ||
|
||
- name: Load vault-k8s ${{ inputs.version }} image | ||
shell: bash | ||
run: | | ||
[ -n "${{ inputs.tarball-file }}" ] || (echo "inputs.tarball-file not set" >&2 ; exit 1) | ||
docker image load --input "${{ inputs.tarball-file }}" | ||
kind load docker-image --name ${{ inputs.kind-cluster-name }} hashicorp/vault-k8s:"${{ inputs.version }}" | ||
- name: Makefile tests | ||
shell: bash | ||
working-directory: vault-k8s | ||
run: make deploy exercise teardown VERSION="${{ inputs.version }}" VAULT_VERSION="${{ inputs.vault-version }}" | ||
|
||
- name: bats tests | ||
shell: bash | ||
working-directory: vault-helm | ||
run: | | ||
# assumes Python based yq :( | ||
yq --in-place --yaml-roundtrip '.injector.image.tag |= "${{ inputs.version }}"' ./values.yaml | ||
yq --in-place --yaml-roundtrip '.server.image.tag |= "${{ inputs.vault-version }}"' ./values.yaml | ||
yq --in-place --yaml-roundtrip '.injector.agentImage.tag |= "${{ inputs.vault-version }}"' ./values.yaml | ||
bats ./test/acceptance -t --filter injector | ||
- name: export kind cluster logs | ||
if: always() | ||
shell: bash | ||
run: | | ||
kind export logs --name ${{ inputs.kind-cluster-name }} ${{ steps.create_kind_export_log_root.outputs.log_root }} | ||
- name: Store kind cluster logs | ||
if: success() | ||
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | ||
with: | ||
name: ${{ steps.create_kind_export_log_root.outputs.log_artifact_name }} | ||
path: ${{ steps.create_kind_export_log_root.outputs.log_root }} | ||
|
||
- name: Store kind cluster logs failure | ||
if: failure() | ||
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | ||
with: | ||
name: ${{ steps.create_kind_export_log_root.outputs.log_artifact_name }}-failed | ||
path: ${{ steps.create_kind_export_log_root.outputs.log_root }} |
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 |
---|---|---|
|
@@ -19,4 +19,7 @@ | |
/pkg | ||
/dist/ | ||
|
||
# directory for misc build files etc. | ||
scratch/ | ||
build/ | ||
vault-helm/ |
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,13 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
global: | ||
tlsDisable: true | ||
injector: | ||
image: | ||
pullPolicy: Never | ||
affinity: null | ||
server: | ||
dev: | ||
enabled: true | ||
logLevel: debug |
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