Skip to content

Commit

Permalink
fix(ci): Adding in all tests for all environments
Browse files Browse the repository at this point in the history
  • Loading branch information
spbsoluble committed Oct 4, 2023
1 parent 4665b32 commit 1abbf00
Show file tree
Hide file tree
Showing 2 changed files with 139 additions and 118 deletions.
247 changes: 130 additions & 117 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,53 @@ jobs:
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
az --version
# Store Type Tests
# Test_Stores_KFC_11_0_0:
# runs-on: self-hosted
# needs: build
# env:
# SECRET_NAME: "command-config-1100"
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
#
# - name: list dir
# run: ls -la
#
# - name: Get secret from Azure Key Vault
# run: |
# . ./examples/auth/akv/akv_auth.sh
#
# - name: Run tests
# run: go test -v ./cmd -run "^Test_Stores*"
#
Test_StoreTypes_KFC_10_4_0:
### Store Type Tests
Test_StoreTypes_KFC_11_0_0:
runs-on: self-hosted
needs: build
env:
SECRET_NAME: "command-config-1040"
SECRET_NAME: "command-config-1100-clean"
steps:
- name: Checkout code
uses: actions/checkout@v4


- name: list dir
run: ls -la

- name: Get secret from Azure Key Vault
run: |
. ./examples/auth/akv/akv_auth.sh
- name: Run tests
run: |
unset KFUTIL_DEBUG
go test -v ./cmd -run "^Test_StoreTypes*"
Test_StoreTypes_KFC_10_4_5:
runs-on: self-hosted
needs: build
env:
SECRET_NAME: "command-config-1045-clean"
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: list dir
run: ls -la

- name: Get secret from Azure Key Vault
run: |
. ./examples/auth/akv/akv_auth.sh
- name: Run tests
run: |
unset KFUTIL_DEBUG
go test -v ./cmd -run "^Test_StoreTypes*"
Test_StoreTypes_KFC_10_2_1:
runs-on: self-hosted
needs: build
env:
SECRET_NAME: "command-config-1021-clean"
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -67,67 +89,53 @@ jobs:
run: |
unset KFUTIL_DEBUG
go test -v ./cmd -run "^Test_StoreTypes*"
# Test_StoreTypes_KFC_10_2_1:
# runs-on: self-hosted
# needs: build
# env:
# SECRET_NAME: "command-config-1021-clean"
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
#
# - name: list dir
# run: ls -la
#
# - name: Get secret from Azure Key Vault
# run: |
# . ./examples/auth/akv/akv_auth.sh
#
# - name: Run tests
# run: go test -v ./cmd -run "^Test_StoreType*"

# Store Tests
# Test_StoreTypes_KFC_11_0_0:
# runs-on: self-hosted
# needs: build
# env:
# SECRET_NAME: "command-config-1100-clean"
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
#
# - name: list dir
# run: ls -la
#
# - name: Get secret from Azure Key Vault
# run: |
# . ./examples/auth/akv/akv_auth.sh
#
# - name: Run tests
# run: go test -v ./cmd -run "^Test_StoreType*"
# Test_Stores_KFC_10_4_0:
# runs-on: self-hosted
# needs: build
# env:
# SECRET_NAME: "command-config-1040"
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
#
# - name: list dir
# run: ls -la
#
# - name: Get secret from Azure Key Vault
# run: |
# . ./examples/auth/akv/akv_auth.sh
#
# - name: Run tests
# run: go test -v ./cmd -run "^Test_Stores*"
### Store Tests
Test_Stores_KFC_11_0_0:
runs-on: self-hosted
needs:
- build
- Test_StoreTypes_KFC_11_0_0
env:
SECRET_NAME: "command-config-1100"
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: list dir
run: ls -la

- name: Get secret from Azure Key Vault
run: |
. ./examples/auth/akv/akv_auth.sh
- name: Run tests
run: go test -v ./cmd -run "^Test_Stores_*"
Test_Stores_KFC_10_4_5:
runs-on: self-hosted
needs:
- build
- Test_StoreTypes_KFC_10_4_5
env:
SECRET_NAME: "command-config-1045"
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: list dir
run: ls -la

- name: Get secret from Azure Key Vault
run: |
. ./examples/auth/akv/akv_auth.sh
- name: Run tests
run: go test -v ./cmd -run "^Test_Stores_*"
Test_Stores_KFC_10_2_1:
runs-on: self-hosted
needs:
- build
- Test_StoreTypes_KFC_10_4_0
- Test_StoreTypes_KFC_10_2_1
env:
SECRET_NAME: "command-config-1021"
steps:
Expand All @@ -146,48 +154,53 @@ jobs:
unset KFUTIL_DEBUG
go test -v ./cmd -run "^Test_Stores_*"
# PAM Tests
# Test_PAM_KFC_11_0_0:
# runs-on: self-hosted
# needs: build
# env:
# SECRET_NAME: "command-config-1100"
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
#
# - name: list dir
# run: ls -la
#
# - name: Get secret from Azure Key Vault
# run: |
# . ./examples/auth/akv/akv_auth.sh
#
# - name: Run tests
# run: go test -v ./cmd -run "^Test_PAM*"
# Test_PAM_KFC_10_4_0:
# runs-on: self-hosted
# needs: build
# env:
# SECRET_NAME: "command-config-1040"
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
#
# - name: list dir
# run: ls -la
#
# - name: Get secret from Azure Key Vault
# run: |
# . ./examples/auth/akv/akv_auth.sh
#
# - name: Run tests
# run: go test -v ./cmd -run "^Test_PAM*"
### PAM Tests
Test_PAM_KFC_11_0_0:
runs-on: self-hosted
needs:
- build
- Test_StoreTypes_KFC_11_0_0
env:
SECRET_NAME: "command-config-1100"
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: list dir
run: ls -la

- name: Get secret from Azure Key Vault
run: |
. ./examples/auth/akv/akv_auth.sh
- name: Run tests
run: go test -v ./cmd -run "^Test_PAM*"
Test_PAM_KFC_10_4_5:
runs-on: self-hosted
needs:
- build
- Test_StoreTypes_KFC_10_4_5
env:
SECRET_NAME: "command-config-1045"
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: list dir
run: ls -la

- name: Get secret from Azure Key Vault
run: |
. ./examples/auth/akv/akv_auth.sh
- name: Run tests
run: go test -v ./cmd -run "^Test_PAM*"
Test_PAM_KFC_10_2_1:
runs-on: self-hosted
needs:
- build
- Test_StoreTypes_KFC_10_4_0
- Test_StoreTypes_KFC_10_2_1
env:
SECRET_NAME: "command-config-1021"
steps:
Expand Down
10 changes: 9 additions & 1 deletion examples/auth/akv/akv_auth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ set -e -o pipefail
# Define the default values using environment variables
default_vault_name="${VAULT_NAME:-kfutil}"
default_secret_name="${SECRET_NAME:-integration-labs}"
echo "Default vault name: $default_vault_name"
echo "Default secret name: $default_secret_name"

export METADATA_URL="http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://vault.azure.net"


read_keyvault_secret() {
local vault_name="$1"
local secret_name="$2"

echo "Vault Name: $vault_name"
echo "Secret Name: $secret_name"

# Make a request to the metadata endpoint
echo "Querying metadata endpoint for access token..."
echo "Metadata URL: $METADATA_URL"
Expand All @@ -36,7 +42,9 @@ read_keyvault_secret() {

#echo "Secret Value: $secret_value"
mkdir -p ~/.keyfactor
echo $secret_value | jq -r . > ~/.keyfactor/command_config.json
echo "${secret_value}" | jq -r . > "${secret_name}.json"
rm -f "${HOME}/.keyfactor/command_config.json" || true
echo "${secret_value}" | jq -r . > "${HOME}/.keyfactor/command_config.json"
# echo $secret_value > .env
}

Expand Down

0 comments on commit 1abbf00

Please sign in to comment.