diff --git a/.github/workflows/scheduled.yml b/.github/workflows/scheduled.yml index 1d1fda5..a570a13 100644 --- a/.github/workflows/scheduled.yml +++ b/.github/workflows/scheduled.yml @@ -17,10 +17,18 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 10 steps: + - name: Install CLI tools from OpenShift Mirror + uses: redhat-actions/openshift-tools-installer@v1 + with: + oc: "4.14.37" + - name: Clean up Helm Releases run: | - oc login --token=${{ secrets.OC_TOKEN }} --server=${{ vars.OC_SERVER }} - oc project ${{ secrets.OC_NAMESPACE }} # Safeguard! + # OC Login + OC_TEMP_TOKEN=$(curl -k -X POST ${{ inputs.oc_server }}/api/v1/namespaces/${{ secrets.oc_namespace }}/serviceaccounts/pipeline/token --header "Authorization: Bearer ${{ secrets.oc_token }}" -d '{"spec": {"expirationSeconds": 600}}' -H 'Content-Type: application/json; charset=utf-8' | jq -r '.status.token' ) + + oc login --token=$OC_TEMP_TOKEN --server=${{ inputs.oc_server }} + oc project ${{ secrets.oc_namespace }} # Safeguard! # Catch errors, unset variables, and pipe failures (e.g. grep || true ) set -euo pipefail