Skip to content

Commit d124014

Browse files
committed
Reusable GitHub action for deploy components (#50)
* feat(integrations): expose variables to root taskfile Signed-off-by: Árpád Csepi <csepi.arpad@outlook.com> * ci: add reusable action for deploy components Signed-off-by: Árpád Csepi <csepi.arpad@outlook.com> * test(ci): add test workflow for reusable components Signed-off-by: Árpád Csepi <csepi.arpad@outlook.com> --------- Signed-off-by: Árpád Csepi <csepi.arpad@outlook.com>
1 parent 114e1ce commit d124014

File tree

3 files changed

+151
-0
lines changed

3 files changed

+151
-0
lines changed
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# Copyright AGNTCY Contributors (https://github.com/agntcy)
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
---
5+
name: Deploy agntcy components
6+
description: Deploy agntcy components for integration testing
7+
inputs:
8+
deploy-gateway:
9+
description: 'Deploy gateway to a kind cluster'
10+
required: false
11+
default: 'false'
12+
gateway-image-version:
13+
description: 'Set gateway container image version'
14+
required: false
15+
default: ''
16+
deploy-directory:
17+
description: 'Deploy directory to a kind cluster'
18+
required: false
19+
default: 'false'
20+
directory-image-version:
21+
description: 'Set directory container image version'
22+
required: false
23+
default: ''
24+
kind-cluster-name:
25+
description: 'Set kind cluster name where components are deployed'
26+
required: false
27+
default: 'agntcy-components'
28+
kind-cluster-namespace:
29+
description: 'Set cluster namespace where components are deployed'
30+
required: false
31+
default: 'default'
32+
github-repository-ref:
33+
description: 'Set a ref for git checkout'
34+
required: false
35+
default: 'main'
36+
install-kind-dependency:
37+
description: 'KinD installer'
38+
required: false
39+
default: 'false'
40+
kind-binary-version:
41+
description: 'Installed KinD version'
42+
required: false
43+
default: 'v0.27.0'
44+
install-taskfile-dependency:
45+
description: 'Taskfile installer'
46+
required: false
47+
default: 'false'
48+
49+
runs:
50+
using: composite
51+
steps:
52+
- name: Checkout agntcy repository
53+
uses: actions/checkout@v4
54+
with:
55+
repository: 'agntcy/csit'
56+
ref: ${{ inputs.github-repository-ref }}
57+
path: 'agntcy-csit'
58+
59+
- name: Install KinD
60+
if: ${{ inputs.install-kind-depedency != 'false' }}
61+
shell: bash
62+
run: |
63+
ARCH=""
64+
if [ $(uname -m) = x86_64 ]; then
65+
ARCH="amd64"
66+
elif [ $(uname -m) = aarch64 ]; then
67+
ARCH="arm64"
68+
else
69+
echo "Unkown architecture, abort!"
70+
exit 1
71+
fi
72+
73+
curl -Lo ./kind https://kind.sigs.k8s.io/dl/${{ inputs.kind-binary-version }}/kind-linux-$ARCH
74+
75+
chmod +x ./kind
76+
sudo mv ./kind /usr/local/bin/kind
77+
78+
- name: Install Taskfile
79+
if: ${{ inputs.install-taskfile-depedency != 'false' }}
80+
uses: arduino/setup-task@v2
81+
with:
82+
version: 3.x
83+
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+
89+
- name: Create kind cluster
90+
shell: bash
91+
run: |
92+
task -d agntcy-csit/ integrations:kind:create \
93+
KIND_CLUSTER_NAME=${{ inputs.kind-cluster-name }}
94+
95+
- name: Deploy Gateway
96+
if: ${{ inputs.deploy-gateway != 'false' }}
97+
shell: bash
98+
run: |
99+
task -d agntcy-csit/ integrations:gateway:test-env:deploy \
100+
GATEWAY_IMAGE_TAG=${{ inputs.gateway-image-version }} \
101+
KIND_CLUSTER_NAME=${{ inputs.kind-cluster-name }} \
102+
HELM_NAMESPACE=${{ inputs.kind-cluster-namespace }}
103+
104+
- name: Deploy Directory
105+
if: ${{ inputs.deploy-directory != 'false' }}
106+
shell: bash
107+
run: |
108+
task -d agntcy-csit/ integrations:directory:test-env:deploy \
109+
DIRECTORY_IMAGE_TAG=${{ inputs.directory-image-version }} \
110+
KIND_CLUSTER_NAME=${{ inputs.kind-cluster-name }} \
111+
HELM_NAMESPACE=${{ inputs.kind-cluster-namespace }}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright AGNTCY Contributors (https://github.com/agntcy)
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: test-reusable-components-action
5+
on:
6+
workflow_dispatch:
7+
8+
jobs:
9+
run-tests-gateway:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Setup Environment
18+
uses: ./.github/actions/deploy-components
19+
with:
20+
deploy-gateway: "true"
21+
deploy-directory: "true"
22+
install-kind-dependency: "true"
23+
install-taskfile-dependency: "true"
24+
25+
- name: Check deployments
26+
shell: bash
27+
run: |
28+
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
29+
30+
chmod +x kubectl && mv ./kubectl /usr/local/bin
31+
kubectl get deployments

integrations/Taskfile.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,18 @@ includes:
1010
gateway:
1111
taskfile: ./agntcy-agp/Taskfile.yml
1212
dir: ./agntcy-agp
13+
vars:
14+
KIND_CLUSTER_NAME: '{{ .KIND_CLUSTER_NAME }}'
15+
GATEWAY_IMAGE_TAG: '{{ .GATEWAY_IMAGE_TAG }}'
16+
HELM_NAMESPACE: '{{ .HELM_NAMESPACE }}'
17+
1318
directory:
1419
taskfile: ./agntcy-dir/Taskfile.yml
1520
dir: ./agntcy-dir
21+
vars:
22+
KIND_CLUSTER_NAME: '{{ .KIND_CLUSTER_NAME }}'
23+
DIRECTORY_IMAGE_TAG: '{{ .DIRECTORY_IMAGE_TAG }}'
24+
HELM_NAMESPACE: '{{ .HELM_NAMESPACE }}'
1625

1726
vars:
1827
KIND_CLUSTER_NAME: '{{ .KIND_CLUSTER_NAME | default "agntcy-test" }}'

0 commit comments

Comments
 (0)