Skip to content

Commit

Permalink
Clean vars
Browse files Browse the repository at this point in the history
  • Loading branch information
a-b committed Oct 25, 2024
1 parent f39f3d7 commit 5f3a6ed
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 17 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/tests-integration-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# secrets.CLIENT_SECRET
# secrets.GITHUB_TOKEN
# secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN
# vars.SHEPHERD_POOL_NAME
# vars.TEST_FLAKE_ATTEMPTS

name: "pvt: run integration tests"

Expand All @@ -25,6 +25,7 @@ on:
lease-namespace:
required: false
type: string
default: 'tas-devex'
gitRef:
type: string
default: ${{github.event.workflow_run.head_sha}}
Expand Down Expand Up @@ -72,8 +73,9 @@ jobs:

- name: Install Tools
env:
account_token: ${{ secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN }}
namespace: ${{ inputs.lease-namespace || vars.POOL_NAMESPACE || 'tas-devex' }}
account_token: ${{ secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN }}
lease_namespace: ${{ inputs.lease-namespace }}
lease_id: ${{ inputs.lease-id }}
run: |
go version
Expand Down Expand Up @@ -107,7 +109,7 @@ jobs:
apt-get install -y build-essential unzip
shepherd login service-account ${account_token}
shepherd get lease ${{ inputs.lease-id }} --namespace tas-devex --json | jq .output > metadata.json
shepherd get lease ${lease_id} --namespace ${lease_namespace} --json | jq .output > metadata.json
- name: Add CATS config
if: ${{ inputs.name == 'cats' }}
Expand Down
37 changes: 24 additions & 13 deletions .github/workflows/tests-integration.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# GitHub repo level Secrets and Variables

# secrets.CLIENT_SECRET
# secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN
# vars.CAPI_RELEASE_VERSION
# vars.SHEPHERD_LEASE_NAMESPACE
# vars.SHEPHERD_POOL_DURATION
# vars.SHEPHERD_POOL_NAME
# vars.SHEPHERD_POOL_NAMESPACE

name: "Tests: Integration"

run-name: "Integration [${{ github.event_name }}: ${{ github.event.pull_request.head.sha || github.event.push.after || github.event.workflow_run.head_sha}}]: ${{ github.event.workflow_run.head_commit.message }}"
Expand Down Expand Up @@ -57,7 +67,7 @@ on:
- ".golangci.json"

env:
SHEPHERD_LEASE_ID: ${{ inputs.lease_id || vars.SHEPHERD_LEASE_ID}}
SHEPHERD_LEASE_ID: ${{ inputs.lease_id }}

jobs:

Expand Down Expand Up @@ -120,20 +130,20 @@ jobs:
- name: claim
id: claim
env:
account_token: ${{ secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN }}
pool_name: ${{ vars.SHEPHERD_POOL_NAME }}
pool_duration: ${{ vars.SHEPHERD_POOL_DURATION || '8h' }}
pool_namespace: ${{ vars.SHEPHERD_POOL_NAMESPACE || 'official' }}
namespace: ${{ inputs.lease_namespace || vars.POOL_NAMESPACE || 'tas-devex' }}
account_token: ${{ secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN }}
pool_name: ${{ vars.SHEPHERD_POOL_NAME }}
pool_duration: ${{ vars.SHEPHERD_POOL_DURATION || '8h' }}
pool_namespace: ${{ vars.SHEPHERD_POOL_NAMESPACE || 'official' }}
lease_namespace: ${{ inputs.lease_namespace || vars.SHEPHERD_LEASE_NAMESPACE || 'tas-devex' }}
run: |
shepherd login service-account ${account_token}
if [[ -z $SHEPHERD_LEASE_ID ]]; then
lease_id=$( shepherd create lease \
--duration ${pool_duration} \
--pool ${pool_name} \
--pool-namespace ${pool_namespace} \
--namespace ${namespace} \
--duration ${pool_duration} \
--pool ${pool_name} \
--pool-namespace ${pool_namespace} \
--namespace ${lease_namespace} \
--description "Claimed by CF CLI workflow ${{ github.workflow_run.url }}" \
--json \
| jq -r .id
Expand Down Expand Up @@ -314,10 +324,11 @@ jobs:
steps:
- name: unclaim
env:
account_token: ${{ secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN }}
namespace: ${{ vars.POOL_NAMESPACE || 'tas-devex' }}
account_token: ${{ secrets.SHEPHERD_SERVICE_ACCOUNT_TOKEN }}
lease_namespace: ${{ inputs.lease_namespace || vars.SHEPHERD_LEASE_NAMESPACE || 'tas-devex' }}
run: |
shepherd login service-account ${account_token}
set -x
shepherd delete lease ${{ needs.claim-env.outputs.leaseid }} \
--namespace ${namespace}
--namespace ${lease_namespace}

0 comments on commit 5f3a6ed

Please sign in to comment.