mirror of
https://github.com/hashicorp/vault.git
synced 2025-12-25 19:31:14 +01:00
Cache scopes allow other branches to inherit default branch scopes, which means that release branches can restore a key from main. Instead, we now include the vault version as part of the cache key to ensure we don't include versions that are incompatible with our version. Signed-off-by: Ryan Cragun <me@ryan.ec>
53 lines
2.2 KiB
YAML
53 lines
2.2 KiB
YAML
# Copyright (c) HashiCorp, Inc.
|
|
# SPDX-License-Identifier: BUSL-1.1
|
|
|
|
---
|
|
name: Create dynamic pipeline configuration
|
|
description: Create dynamic test configuration by restoring existing valid config or creating new config
|
|
|
|
inputs:
|
|
github-token:
|
|
description: An elevated Github token to access private HashiCorp modules.
|
|
vault-edition:
|
|
description: The vault edition to use when generating the dynamic config
|
|
vault-version:
|
|
description: The vault version to use when generating the dynamic config
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: dyn-cfg-metadata
|
|
id: dyn-cfg-metadata
|
|
shell: bash
|
|
run: |
|
|
# We're using a weekly cache key here so that we only regenerate the configuration on a
|
|
# weekly basis. If/when Github decides to purge our tiny config file cache we'll also
|
|
# recreate it as necessary.
|
|
#
|
|
# Uses GITHUB_ENV instead of GITHUB_OUTPUT because composite actions are broken,
|
|
# see: https://github.com/actions/cache/issues/803#issuecomment-1793565071
|
|
{
|
|
echo "DYNAMIC_CONFIG_KEY=${{ inputs.vault-version }}-$(date +%Y-%m-%U)"
|
|
echo "DYNAMIC_CONFIG_PATH=enos/enos-dynamic-config.hcl"
|
|
} | tee -a "$GITHUB_ENV"
|
|
- name: Try to restore dynamic config from cache
|
|
id: dyn-cfg-cache
|
|
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
|
|
with:
|
|
path: ${{ env.DYNAMIC_CONFIG_PATH }}
|
|
key: dyn-cfg-${{ env.DYNAMIC_CONFIG_KEY }}
|
|
- if: steps.dyn-cfg-cache.outputs.cache-hit != 'true'
|
|
id: dyn-cfg-set-up-pipeline
|
|
# If we can't restore it from config then set up pipeline and generate it
|
|
name: Set up the pipeline tool
|
|
uses: ./.github/actions/set-up-pipeline
|
|
with:
|
|
github-token: ${{ inputs.github-token }}
|
|
- if: steps.dyn-cfg-cache.outputs.cache-hit != 'true'
|
|
id: dyn-cfg-generate
|
|
name: Create dynamic configuration
|
|
shell: bash
|
|
run: |
|
|
# Make sure that any branch specific dynamic config has been generated
|
|
pipeline generate enos-dynamic-config -d ./enos -f enos-dynamic-config.hcl -v ${{ inputs.vault-version }} -e ${{ inputs.vault-edition }} -n 3 --log debug
|