Skip to content

Commit 692fdb8

Browse files
committed
fix up NGTS e2e, add github action
This fails in GHA currently, likely due to IP restrictions Signed-off-by: Ashley Davis <ashley.davis@cyberark.com>
1 parent 8826723 commit 692fdb8

2 files changed

Lines changed: 46 additions & 10 deletions

File tree

.github/workflows/tests.yaml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,41 @@ jobs:
109109
ARK_USERNAME: ${{ secrets.ARK_USERNAME }}
110110
ARK_SECRET: ${{ secrets.ARK_SECRET }}
111111

112+
ngts-test-e2e:
113+
# TEMPORARY: require an explicit label to test NGTS until we have a stable test environment
114+
if: contains(github.event.pull_request.labels.*.name, 'test-ngts')
115+
runs-on: ubuntu-latest
116+
steps:
117+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
118+
# Adding `fetch-depth: 0` makes sure tags are also fetched. We need
119+
# the tags so `git describe` returns a valid version.
120+
# see https://github.com/actions/checkout/issues/701 for extra info about this option
121+
with: { fetch-depth: 0 }
122+
123+
- uses: ./.github/actions/repo_access
124+
with:
125+
DEPLOY_KEY_READ_VENAFI_CONNECTION_LIB: ${{ secrets.DEPLOY_KEY_READ_VENAFI_CONNECTION_LIB }}
126+
127+
- id: go-version
128+
run: |
129+
make print-go-version >> "$GITHUB_OUTPUT"
130+
131+
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
132+
with:
133+
go-version: ${{ steps.go-version.outputs.result }}
134+
135+
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
136+
with:
137+
path: _bin/downloaded
138+
key: downloaded-${{ runner.os }}-${{ hashFiles('klone.yaml') }}-test-unit
139+
140+
- run: make -j ngts-test-e2e
141+
env:
142+
OCI_BASE: ${{ secrets.NGTS_OCI_BASE }}
143+
NGTS_CLIENT_ID: ${{ secrets.NGTS_CLIENT_ID }}
144+
NGTS_PRIVATE_KEY: ${{ secrets.NGTS_PRIVATE_KEY }}
145+
NGTS_TSG_ID: ${{ secrets.NGTS_TSG_ID }}
146+
112147
test-e2e:
113148
if: contains(github.event.pull_request.labels.*.name, 'test-e2e')
114149
runs-on: ubuntu-latest
@@ -149,7 +184,7 @@ jobs:
149184
id: timestamp # Give the step an ID to reference its output
150185
run: |
151186
# Generate a timestamp in the format YYMMDD-HHMMSS.
152-
# Extracting from PR name would require sanitization due to GKE cluster naming constraints
187+
# Extracting from PR name would require sanitization due to GKE cluster naming constraints
153188
TIMESTAMP=$(date +'%y%m%d-%H%M%S')
154189
CLUSTER_NAME="test-secretless-${TIMESTAMP}"
155190
echo "Generated cluster name: ${CLUSTER_NAME}"

hack/ngts/test-e2e.sh

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ fi
5656

5757
kubectl create ns "$NAMESPACE" || true
5858

59-
kubectl delete secret agent-credentials --namespace "$NAMESPACE" --ignore-not-found
60-
kubectl create secret generic agent-credentials \
59+
kubectl delete secret discovery-agent-credentials --namespace "$NAMESPACE" --ignore-not-found
60+
kubectl create secret generic discovery-agent-credentials \
6161
--namespace "$NAMESPACE" \
62-
--from-literal=CLIENT_ID=$NGTS_CLIENT_ID \
63-
--from-literal=PRIVATE_KEY="$NGTS_PRIVATE_KEY"
62+
--from-literal=clientID=$NGTS_CLIENT_ID \
63+
--from-literal=privatekey.pem="$NGTS_PRIVATE_KEY"
6464

6565
# Create a sample secret in the cluster
6666
kubectl create secret generic e2e-sample-secret-$(date '+%s') \
@@ -80,17 +80,18 @@ helm upgrade agent "oci://${NGTS_CHART}:NON_EXISTENT_TAG@${NGTS_CHART_DIGEST}" \
8080
--set "imageRegistry=${OCI_BASE}" \
8181
--set "imageNamespace=" \
8282
--set "image.digest=${NGTS_IMAGE_DIGEST}" \
83-
--set config.clusterName="e2e-test-cluster" \
84-
--set config.clusterDescription="A temporary cluster for E2E testing." \
83+
--set config.clusterName="e2e-test-cluster-ngts" \
84+
--set config.clusterDescription="A temporary cluster for E2E testing NGTS" \
8585
--set config.period=60s \
86-
--set ngts.tsgId="${NGTS_TSG_ID}" \
86+
--set config.tsgID="${NGTS_TSG_ID}" \
87+
--set config.serverURL="https://${NGTS_TSG_ID}.ngts.dev.venafi.io" \
8788
--set-json "podLabels={\"discovery-agent.ngts/test-id\": \"${RANDOM}\"}"
8889

8990
kubectl rollout status deployments/discovery-agent --namespace "${NAMESPACE}"
9091

91-
# Wait 60s for log message indicating success.
92+
# Wait for log message indicating success.
9293
# Parse logs as JSON using jq to ensure logs are all JSON formatted.
93-
timeout 60 jq -n \
94+
timeout 120 jq -n \
9495
'inputs | if .msg | test("Data sent successfully") then . | halt_error(0) else . end' \
9596
<(kubectl logs deployments/discovery-agent --namespace "${NAMESPACE}" --follow)
9697

0 commit comments

Comments
 (0)