Skip to content

Merge branch 'scim/2.9.9' of https://github.com/1Password/op-scim-hel… #278

Merge branch 'scim/2.9.9' of https://github.com/1Password/op-scim-hel…

Merge branch 'scim/2.9.9' of https://github.com/1Password/op-scim-hel… #278

name: Lint and test charts
on:
push:
# Workflow dispatch listener to enable on-demand acceptance test runs on external PRs.
# How to use this:
# * Do a sanity check on the submitted PR
# * Copy the most recent commit hash of the PR branch
# * Go to 'Actions' -> 'Lint and test charts' -> 'Run workflow'
# * Fill in the following:
# * `checkout-repo`: `<PR author>/op-scim-helm`
# * `checkout-ref`: <copied commit hash>
# * `branch`: `acceptance-tests-on-forks`
workflow_dispatch:
inputs:
checkout-repo:
description: "Checkout repo"
required: false
checkout-ref:
description: "Chekout ref"
required: false
jobs:
lint-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
repository: ${{ github.event.inputs.checkout-repo }}
ref: ${{ github.event.inputs.checkout-ref }}
- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.14.3
# Set up Python for ct lint, which needs Python for Yamale and yamllint
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Set up chart test CLI
uses: helm/[email protected]
with:
version: v3.4.0
- name: Lint chart
run: ct lint --config ct.yaml
- name: Check if chart has changed
id: list-changed
run: |
changed=$(ct list-changed --config ct.yaml)
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
# We install yq only when the chart has changed
- name: Install yq
run: sudo snap install yq
if: steps.list-changed.outputs.changed == 'true'
- name: Add secrets and fixtures required by tests
env:
OP_SESSION: ${{ secrets.OP_SESSION }}
OP_TOKEN: ${{ secrets.OP_TOKEN }}
run: |
cat > fixtures.yaml << EOF
acceptanceTests:
enabled: true
EOF
for values_file in charts/op-scim-bridge/ci/*.yaml; do
# Add secrets
yq eval '.scim.credentials.secret.scimsession.value_base64 = strenv(OP_SESSION) | .scim.credentialsSecret.token = strenv(OP_TOKEN)' -i $values_file
# Add acceptance test fixtures
yq eval-all --inplace 'select(fileIndex == 0) * select(fileIndex == 1)' $values_file fixtures.yaml
done
- name: Spin up local Kubernetes cluster
uses: helm/[email protected]
- name: Deploy and run acceptance tests
run: ct install --config ct.yaml