Skip to content

Commit fdcd3d8

Browse files
authored
GitHub Action workflow_dispatch support (#54)
* feat(integration): add repository_dispatch trigger Signed-off-by: Árpád Csepi <csepi.arpad@outlook.com> * chore(integration): remove comments Signed-off-by: Árpád Csepi <csepi.arpad@outlook.com> * ci(integration): add option to checkout repository Signed-off-by: Árpád Csepi <csepi.arpad@outlook.com> * ci(integrations): replace deploys with action Signed-off-by: Árpád Csepi <csepi.arpad@outlook.com> * ci(integrations): add checkout path input Signed-off-by: Árpád Csepi <csepi.arpad@outlook.com> * ci(integrations): rename input name to reflect docker tag Signed-off-by: Árpád Csepi <csepi.arpad@outlook.com> * ci(integrations): override tag version from client payload Signed-off-by: Árpád Csepi <csepi.arpad@outlook.com> * ci(integrations): add test workflow to test trigger Signed-off-by: Árpád Csepi <csepi.arpad@outlook.com> * ci(integrations): replace repository_dispatch to workflow_dispatch Signed-off-by: Árpád Csepi <csepi.arpad@outlook.com> * ci(integrations): rewrite ci test Signed-off-by: Árpád Csepi <csepi.arpad@outlook.com> * ci(integrations): replace dash with underscore Signed-off-by: Árpád Csepi <csepi.arpad@outlook.com> * ci(integrations): rename step name Signed-off-by: Árpád Csepi <csepi.arpad@outlook.com> * feat(integrations): expose image flags to main taskfile Signed-off-by: Árpád Csepi <csepi.arpad@outlook.com> --------- Signed-off-by: Árpád Csepi <csepi.arpad@outlook.com>
1 parent 8c2016b commit fdcd3d8

File tree

4 files changed

+71
-32
lines changed

4 files changed

+71
-32
lines changed

.github/actions/deploy-components/action.yaml

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,34 @@
55
name: Deploy agntcy components
66
description: Deploy agntcy components for integration testing
77
inputs:
8+
checkout-repository:
9+
description: 'Checkout AGNTCY repository'
10+
required: false
11+
default: 'false'
12+
checkout-path:
13+
description: 'Path to checkout AGNTCY repository'
14+
required: false
15+
default: ''
816
deploy-gateway:
917
description: 'Deploy gateway to a kind cluster'
1018
required: false
1119
default: 'false'
12-
gateway-image-version:
20+
gateway-image-tag:
1321
description: 'Set gateway container image version'
1422
required: false
1523
default: ''
1624
deploy-directory:
1725
description: 'Deploy directory to a kind cluster'
1826
required: false
1927
default: 'false'
20-
directory-image-version:
28+
directory-image-tag:
2129
description: 'Set directory container image version'
2230
required: false
2331
default: ''
2432
kind-cluster-name:
2533
description: 'Set kind cluster name where components are deployed'
2634
required: false
27-
default: 'agntcy-components'
35+
default: 'agntcy-test'
2836
kind-cluster-namespace:
2937
description: 'Set cluster namespace where components are deployed'
3038
required: false
@@ -50,11 +58,12 @@ runs:
5058
using: composite
5159
steps:
5260
- name: Checkout agntcy repository
61+
if: ${{ inputs.checkout-repository != 'false' }}
5362
uses: actions/checkout@v4
5463
with:
5564
repository: 'agntcy/csit'
5665
ref: ${{ inputs.github-repository-ref }}
57-
path: 'agntcy-csit'
66+
path: ${{ inputs.checkout-path }}
5867

5968
- name: Install KinD
6069
if: ${{ inputs.install-kind-depedency != 'false' }}
@@ -81,31 +90,26 @@ runs:
8190
with:
8291
version: 3.x
8392

84-
# Maybe /usr/local/bin is already in PATH by default
85-
# - name: Update GITHUB_PATH
86-
# shell: bash
87-
# run: echo "/usr/local/bin" >> $GITHUB_PATH
88-
8993
- name: Create kind cluster
9094
shell: bash
9195
run: |
92-
task -d agntcy-csit/ integrations:kind:create \
96+
task -d ./${{ inputs.checkout-path }} integrations:kind:create \
9397
KIND_CLUSTER_NAME=${{ inputs.kind-cluster-name }}
9498
9599
- name: Deploy Gateway
96100
if: ${{ inputs.deploy-gateway != 'false' }}
97101
shell: bash
98102
run: |
99-
task -d agntcy-csit/ integrations:gateway:test-env:deploy \
100-
GATEWAY_IMAGE_TAG=${{ inputs.gateway-image-version }} \
103+
task -d ./${{ inputs.checkout-path }} integrations:gateway:test-env:deploy \
104+
GATEWAY_IMAGE_TAG=${{ inputs.gateway-image-tag }} \
101105
KIND_CLUSTER_NAME=${{ inputs.kind-cluster-name }} \
102106
HELM_NAMESPACE=${{ inputs.kind-cluster-namespace }}
103107
104108
- name: Deploy Directory
105109
if: ${{ inputs.deploy-directory != 'false' }}
106110
shell: bash
107111
run: |
108-
task -d agntcy-csit/ integrations:directory:test-env:deploy \
109-
DIRECTORY_IMAGE_TAG=${{ inputs.directory-image-version }} \
112+
task -d ./${{ inputs.checkout-path }} integrations:directory:test-env:deploy \
113+
DIRECTORY_IMAGE_TAG=${{ inputs.directory-image-tag }} \
110114
KIND_CLUSTER_NAME=${{ inputs.kind-cluster-name }} \
111115
HELM_NAMESPACE=${{ inputs.kind-cluster-namespace }}

.github/workflows/test-integrations.yaml

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,18 @@ on:
99
pull_request:
1010
workflow_dispatch:
1111
inputs:
12-
kind-version:
12+
kind_version:
1313
description: 'Kind version'
1414
required: false
1515
default: '0.24.0'
16-
16+
override_directory_image_tag:
17+
description: 'Directory image tag'
18+
required: false
19+
default: ''
20+
override_gateway_image_tag:
21+
description: 'Gateway image tag'
22+
required: false
23+
default: ''
1724
jobs:
1825
set-kind-version:
1926
runs-on: ubuntu-latest
@@ -27,7 +34,7 @@ jobs:
2734
shell: bash
2835
run: |
2936
if [ "${{ github.event_name }}" == 'workflow_dispatch' ]; then
30-
KIND_VERSION="${{ inputs.kind-version }}"
37+
KIND_VERSION="${{ inputs.kind_version }}"
3138
fi
3239
3340
echo "Set KinD version to: $KIND_VERSION"
@@ -67,13 +74,11 @@ jobs:
6774
with:
6875
kind-version: ${{ needs.set-kind-version.outputs.kind-version }}
6976

70-
- name: Create kind cluster
71-
run: task integrations:kind:create
72-
shell: bash
73-
74-
- name: Deploy agntcy agp
75-
run: task integrations:gateway:test-env:deploy
76-
shell: bash
77+
- name: Deploy Gateway
78+
uses: ./.github/actions/deploy-components
79+
with:
80+
deploy-gateway: 'true'
81+
gateway-image-tag: ${{ inputs.override_gateway_image_tag }}
7782

7883
- name: Run simple gateway tests
7984
env:
@@ -119,14 +124,12 @@ jobs:
119124
with:
120125
kind-version: ${{ needs.set-kind-version.outputs.kind-version }}
121126

122-
- name: Create kind cluster
123-
run: task integrations:kind:create
124-
shell: bash
125-
126-
- name: Deploy agntcy dir
127-
run: task integrations:directory:test-env:deploy
128-
shell: bash
127+
- name: Deploy Directory
128+
uses: ./.github/actions/deploy-components
129+
with:
130+
deploy-directory: 'true'
131+
directory-image-tag: ${{ inputs.override_directory_image_tag}}
129132

130-
- name: Run agent build tests
133+
- name: Run Directory tests
131134
run: task integrations:directory:test
132135
shell: bash
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright AGNTCY Contributors (https://github.com/agntcy)
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: test-remote-workflow-dispatch-trigger
5+
on:
6+
workflow_dispatch:
7+
pull_request:
8+
9+
jobs:
10+
trigger-integration-workflow:
11+
runs-on: ubuntu-latest
12+
permissions: write-all # TODO: Find the correct permission or create PAT token
13+
steps:
14+
- name: Repository Dispatch
15+
uses: actions/github-script@v7
16+
with:
17+
script: |
18+
await github.rest.actions.createWorkflowDispatch({
19+
owner: 'agntcy',
20+
repo: 'csit',
21+
workflow_id: 'test-integrations.yaml',
22+
ref: 'feat/gh-action-repository-dispatch',
23+
inputs: {
24+
override_gateway_image_tag: '0.3.11',
25+
override_directory_image_tag: 'v0.2.1',
26+
},
27+
});
28+
debug: true

Taskfile.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ includes:
1010
integrations:
1111
taskfile: ./integrations/Taskfile.yml
1212
dir: ./integrations
13+
vars:
14+
DIRECTORY_IMAGE_TAG: '{{ .DIRECTORY_IMAGE_TAG }}'
15+
GATEWAY_IMAGE_TAG: '{{ .GATEWAY_IMAGE_TAG }}'
16+
1317
samples:
1418
taskfile: ./samples/Taskfile.yml
1519
dir: ./samples

0 commit comments

Comments
 (0)