Skip to content

Commit

Permalink
feat: unhardcode the deployed trustify app name
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Crossley <[email protected]>
  • Loading branch information
jcrossley3 committed Oct 9, 2024
1 parent 54a603c commit 51eb547
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .github/actions/install-trustify/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ inputs:
description: "JSON encoded Trustify Custom Resource (CR) string"
required: false
default: ""
app-name:
description: "Name of the Trustify instance (should match CR metadata if passed)"
required: false
default: "myapp"
runs:
using: "composite"
steps:
Expand All @@ -39,6 +43,7 @@ runs:
env:
OPERATOR_BUNDLE_IMAGE: ${{ inputs.operator-bundle-image }}
NAMESPACE: ${{ inputs.namespace }}
APP_NAME: ${{ inputs.app-name }}
TRUSTIFY_CR: ${{ inputs.trustify-cr }}
run: |
make install-trustify
Expand Down
13 changes: 7 additions & 6 deletions hack/install-trustify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -x
set -o pipefail

NAMESPACE="${NAMESPACE:-trustify}"
APP_NAME="${APP_NAME:-myapp}"
OPERATOR_BUNDLE_IMAGE="${OPERATOR_BUNDLE_IMAGE:-ghcr.io/trustification/trustify-operator-bundle:latest}"
TRUSTIFY_CR="${TRUSTIFY_CR:-}"
TIMEOUT="${TIMEOUT:-15m}"
Expand Down Expand Up @@ -47,35 +48,35 @@ install_trustify() {
kind: Trustify
apiVersion: org.trustify/v1alpha1
metadata:
name: myapp
name: ${APP_NAME}
spec: {}
EOF
fi

# Want to see in github logs what we just created
kubectl get --namespace "${NAMESPACE}" -o yaml trustifies.org.trustify/myapp
kubectl get --namespace "${NAMESPACE}" -o yaml trustifies.org.trustify/${APP_NAME}

# Wait for reconcile to finish
kubectl wait \
--namespace ${NAMESPACE} \
--for=condition=Successful \
--timeout=600s \
trustifies.org.trustify/myapp \
trustifies.org.trustify/${APP_NAME} \
|| kubectl get \
--namespace ${NAMESPACE} \
-o yaml \
trustifies.org.trustify/myapp # Print trustify debug when timed out
trustifies.org.trustify/${APP_NAME} # Print trustify debug when timed out

# Now wait for all the trustify deployments
kubectl wait \
--namespace ${NAMESPACE} \
--selector="app.kubernetes.io/part-of=myapp" \
--selector="app.kubernetes.io/part-of=${APP_NAME}" \
--for=condition=Available \
--timeout=600s \
deployments.apps \
|| kubectl get \
--namespace ${NAMESPACE} \
--selector="app.kubernetes.io/part-of=myapp" \
--selector="app.kubernetes.io/part-of=${APP_NAME}" \
--field-selector=status.phase!=Running \
-o yaml \
pods # Print not running trustify pods when timed out
Expand Down

0 comments on commit 51eb547

Please sign in to comment.