Skip to content

Commit 21359bc

Browse files
committed
fix: mc epoch to wait for
1 parent 2affc44 commit 21359bc

File tree

3 files changed

+20
-39
lines changed

3 files changed

+20
-39
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
1-
name: "Test Against Staging Preview Environment"
2-
description: "Tests against Staging Preview Environment"
3-
inputs:
4-
node-host:
5-
description: "Host for the node"
6-
required: true
7-
node-port:
8-
description: "Port for the node"
9-
required: true
1+
name: "Install and configure kubectl and awscli"
2+
description: "Install and configure kubectl and awscli (used in e2e tests)"
103

114
outputs: {}
125

@@ -28,15 +21,3 @@ runs:
2821
kubectl config set-context my-context --cluster=my-cluster --user=github-actions --namespace=default
2922
kubectl config use-context my-context
3023
shell: bash
31-
- name: Health check integration env
32-
run: |
33-
curl --request POST \
34-
--url "http://${{ inputs['node-host'] }}:${{ inputs['node-port'] }}" \
35-
--header 'Content-Type: application/json' \
36-
--data '{
37-
"jsonrpc": "2.0",
38-
"method": "sidechain_getStatus",
39-
"params": [],
40-
"id": 1
41-
}'
42-
shell: bash

.github/actions/tests/wait-for-epoch/action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ runs:
3434
if [ "${{ inputs.environment }}" == "staging-preview" ]; then
3535
testnet_magic=2
3636
elif [ "${{ inputs.environment }}" == "staging-preprod" ]; then
37-
testnet_magic=1
37+
testnet_magic=1
3838
else
3939
echo "Invalid environment for Kubernetes deployment"
4040
exit 1

.github/workflows/cd.yml

+17-17
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ permissions:
2020
env:
2121
AWS_REGION: "eu-central-1"
2222
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
23+
STAGING_PREVIEW_SERVICES_HOST: staging-preview-services-service.staging-preview.svc.cluster.local
2324
STAGING_PREVIEW_VALIDATOR_1_HOST: staging-preview-validator-1-service.staging-preview.svc.cluster.local
2425
STAGING_PREVIEW_VALIDATOR_1_PORT: 9933
2526

@@ -176,7 +177,13 @@ jobs:
176177
partner-chain-ready:
177178
runs-on: [self-hosted, eks]
178179
needs: deploy-staging-preview
180+
outputs:
181+
deployment_mc_epoch: ${{ steps.mc-epoch.outputs.deployment_mc_epoch }}
179182
steps:
183+
- name: Set deployment main chain epoch
184+
id: mc-epoch
185+
run: echo "deployment_mc_epoch=$(curl -s http://$STAGING_PREVIEW_SERVICES_HOST:1337/health | jq .currentEpoch)" >> $GITHUB_OUTPUT
186+
shell: bash
180187
- name: Check Finalization Status
181188
run: |
182189
FINALIZED_NUMBER=$(
@@ -204,9 +211,6 @@ jobs:
204211
uses: actions/checkout@v4
205212
- name: Configure kubectl
206213
uses: ./.github/actions/tests/staging-preview-tests
207-
with:
208-
node-host: $STAGING_PREVIEW_VALIDATOR_1_HOST
209-
node-port: $STAGING_PREVIEW_VALIDATOR_1_PORT
210214
env:
211215
kubeconfig_base64: ${{ secrets.kubeconfig_base64 }}
212216
K8S_SERVER: ${{ secrets.K8S_SERVER }}
@@ -234,9 +238,6 @@ jobs:
234238
uses: actions/checkout@v4
235239
- name: Configure kubectl
236240
uses: ./.github/actions/tests/staging-preview-tests
237-
with:
238-
node-host: $STAGING_PREVIEW_VALIDATOR_1_HOST
239-
node-port: $STAGING_PREVIEW_VALIDATOR_1_PORT
240241
env:
241242
kubeconfig_base64: ${{ secrets.kubeconfig_base64 }}
242243
K8S_SERVER: ${{ secrets.K8S_SERVER }}
@@ -245,18 +246,16 @@ jobs:
245246
uses: ./.github/actions/tests/setup-python
246247
env:
247248
ACTIONS_PAT: ${{ secrets.ACTIONS_PAT }}
248-
- name: Save deployment main chain epoch
249-
run: |
250-
echo "DEPLOYMENT_MC_EPOCH=$(curl -s http://staging-preview-services-service.staging-preview.svc.cluster.local:1337/health | jq .currentEpoch)" >> $GITHUB_ENV
251-
shell: bash
252249
- name: Run all tests (some skipped due to new deployment)
253250
uses: ./.github/actions/tests/run-e2e-tests
251+
env:
252+
DEPLOYMENT_MC_EPOCH: ${{needs.partner-chain-ready.outputs.deployment_mc_epoch}}
254253
with:
255254
blockchain: substrate
256255
env: staging
257256
decrypt: true
258257
markers: "not active_flow and not passive_flow"
259-
deployment_mc_epoch: ${{ env.DEPLOYMENT_MC_EPOCH }}
258+
deployment_mc_epoch: $DEPLOYMENT_MC_EPOCH
260259

261260
wait-for-next-epoch:
262261
permissions:
@@ -269,15 +268,17 @@ jobs:
269268
uses: actions/checkout@v4
270269
- name: Set MC epoch to wait for
271270
id: increment-epoch
271+
env:
272+
DEPLOYMENT_MC_EPOCH: ${{needs.partner-chain-ready.outputs.deployment_mc_epoch}}
272273
run: |
273274
echo "Current epoch: $DEPLOYMENT_MC_EPOCH"
274275
incremented_epoch=$((DEPLOYMENT_MC_EPOCH + 1))
275276
echo "Incremented epoch: $incremented_epoch"
276-
echo "::set-output name=epoch::$incremented_epoch"
277+
echo "mc_epoch_to_wait_for=$incremented_epoch" >> $GITHUB_OUTPUT
277278
- name: Wait for next MC epoch
278279
uses: ./.github/actions/tests/wait-for-epoch
279280
with:
280-
epoch: ${{ steps.increment-epoch.outputs.epoch }}"
281+
epoch: ${{ steps.increment-epoch.outputs.mc_epoch_to_wait_for }}"
281282
deployment: kubernetes
282283
node: staging-preview-validator-1
283284
environment: staging-preview
@@ -293,9 +294,6 @@ jobs:
293294
uses: actions/checkout@v4
294295
- name: Configure kubectl
295296
uses: ./.github/actions/tests/staging-preview-tests
296-
with:
297-
node-host: $STAGING_PREVIEW_VALIDATOR_1_HOST
298-
node-port: $STAGING_PREVIEW_VALIDATOR_1_PORT
299297
env:
300298
kubeconfig_base64: ${{ secrets.kubeconfig_base64 }}
301299
K8S_SERVER: ${{ secrets.K8S_SERVER }}
@@ -306,13 +304,15 @@ jobs:
306304
ACTIONS_PAT: ${{ secrets.ACTIONS_PAT }}
307305
- name: Run all tests (some skipped due to new deployment)
308306
uses: ./.github/actions/tests/run-e2e-tests
307+
env:
308+
DEPLOYMENT_MC_EPOCH: ${{needs.partner-chain-ready.outputs.deployment_mc_epoch}}
309309
with:
310310
blockchain: substrate
311311
env: staging
312312
decrypt: true
313313
latest_mc_epoch: true
314314
markers: "not active_flow and not passive_flow"
315-
deployment_mc_epoch: ${{ env.DEPLOYMENT_MC_EPOCH }}
315+
deployment_mc_epoch: $DEPLOYMENT_MC_EPOCH
316316

317317
# build-and-publish-ghcr:
318318
# permissions:

0 commit comments

Comments
 (0)