Skip to content

Commit

Permalink
ci(workflow): add integration-test-latest|release and helm-integratio…
Browse files Browse the repository at this point in the history
…n-test-latest|release workflow for mac
  • Loading branch information
Sarthak-instill committed Sep 25, 2023
1 parent bd8543f commit c00e77f
Show file tree
Hide file tree
Showing 7 changed files with 494 additions and 17 deletions.
261 changes: 255 additions & 6 deletions .github/workflows/helm-integration-test-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
type: string

jobs:
helm-integration-test-latest:
helm-integration-test-latest-linux:
if: inputs.target == 'latest'
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -88,6 +88,121 @@ jobs:
with:
envFile: .env

- name: Launch Instill VDP (latest)
run: |
helm install vdp charts/vdp --namespace instill-ai --create-namespace \
--set edition=k8s-ce:test \
--set pipelineBackend.image.tag=latest \
--set connectorBackend.image.tag=latest \
--set controllerVDP.image.tag=latest \
--set tags.observability=false
kubectl rollout status deployment vdp-connector-backend --namespace instill-ai
kubectl rollout status deployment vdp-pipeline-backend --namespace instill-ai
kubectl rollout status deployment vdp-controller-vdp --namespace instill-ai
sleep 10
- name: Run ${{ inputs.component }} integration test (latest)
if: inputs.target == 'latest'
run: |
git clone https://github.com/instill-ai/${{ inputs.component }}.git
cd ${{ inputs.component }}
make integration-test API_GATEWAY_URL=localhost:${API_GATEWAY_PORT}
helm-integration-test-latest-mac:
if: inputs.target == 'latest'
runs-on: [self-hosted,macOS,vdp]
steps:
- name: Set up environment
run: |
brew install make
- name: Checkout repo (vdp)
uses: actions/checkout@v3
with:
repository: instill-ai/vdp

- name: Load .env file (vdp)
uses: cardinalby/export-env-action@v2
with:
envFile: .env

- name: Check if VDP Helm release exists
id: check-vdp-helm-release
run: |
if helm ls -n instill-ai | grep -q 'vdp'; then
echo "Helm release 'vdp' found."
echo "release_exists=true" >> $GITHUB_OUTPUT
else
echo "Helm release 'vdp' not found."
fi
- name: Uninstall VDP Helm Release
if: steps.check-vdp-helm-release.outputs.release_exists == 'true'
run: |
helm uninstall vdp --namespace instill-ai
- name: Install k6
run: |
brew install k6
- name: Checkout repo
uses: actions/checkout@v3
with:
repository: instill-ai/base

- name: Load .env file
uses: cardinalby/export-env-action@v2
with:
envFile: .env

- name: Check if Base Helm release exists
id: check-base-helm-release
run: |
if helm ls -n instill-ai | grep -q 'base'; then
echo "Helm release 'base' found."
echo "release_exists=true" >> $GITHUB_OUTPUT
else
echo "Helm release 'base' not found."
fi
- name: Uninstall Base Helm Release
if: steps.check-base-helm-release.outputs.release_exists == 'true'
run: |
helm uninstall base --namespace instill-ai
kubectl delete namespace instill-ai
- name: Launch Helm Instill Base (latest)
run: |
helm install base charts/base --namespace instill-ai --create-namespace \
--set edition=k8s-ce:test \
--set apiGateway.image.tag=latest \
--set mgmtBackend.image.tag=latest \
--set console.image.tag=latest \
--set tags.observability=false
- name: Wait for base pods up
run: |
while [[ $(kubectl get pods --namespace instill-ai -l "app.kubernetes.io/component=api-gateway,app.kubernetes.io/instance=base" -o 'jsonpath={..status.phase}') != *"Running"* ]]; do
echo "$(kubectl get pods --namespace instill-ai)"
sleep 10
done
- name: Port-forward of api-gateway
run: |
API_GATEWAY_POD_NAME=$(kubectl get pods --namespace instill-ai -l "app.kubernetes.io/component=api-gateway,app.kubernetes.io/instance=base" -o json | jq -r '.items[0].metadata.name')
kubectl --namespace instill-ai port-forward ${API_GATEWAY_POD_NAME} ${API_GATEWAY_PORT}:${API_GATEWAY_PORT} > /dev/null 2>&1 &
while ! nc -vz localhost ${API_GATEWAY_PORT} > /dev/null 2>&1; do sleep 1; done
- name: Checkout repo (vdp)
uses: actions/checkout@v3
with:
repository: instill-ai/vdp

- name: Load .env file (vdp)
uses: cardinalby/export-env-action@v2
with:
envFile: .env

- name: Launch Instill VDP (latest)
run: |
helm install vdp charts/vdp --namespace instill-ai --create-namespace \
Expand All @@ -106,9 +221,15 @@ jobs:
run: |
git clone https://github.com/instill-ai/${{ inputs.component }}.git
cd ${{ inputs.component }}
make integration-test API_GATEWAY_URL=localhost:${API_GATEWAY_PORT}
make integration-test API_GATEWAY_URL=host.docker.internal:${API_GATEWAY_PORT}
- name: Uninstall Base and VDP Helm Release
run: |
helm uninstall vdp --namespace instill-ai
helm uninstall base --namespace instill-ai
kubectl delete namespace instill-ai
helm-integration-test-release:
helm-integration-test-release-linux:
if: inputs.target == 'release'
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -158,8 +279,9 @@ jobs:
helm install base charts/base --namespace instill-ai --create-namespace \
--set edition=k8s-ce:test \
--set mgmtBackend.image.tag=${MGMT_BACKEND_VERSION} \
--set console.image.tag=${CONSOLE_VERSION} \
--set tags.observability=false
--set apiGateway.image.tag=${API_GATEWAY_VERSION} \
--set tags.observability=false \
--set tags.prometheusStack=false
- name: Wait for base pods up
run: |
Expand Down Expand Up @@ -189,6 +311,127 @@ jobs:
run: |
echo "COMPONENT_NAME=$(echo ${{ inputs.component }} | tr 'a-z-' 'A-Z_')" >> $GITHUB_OUTPUT
- name: Launch Helm Instill VDP (release)
run: |
helm install vdp charts/vdp --namespace instill-ai --create-namespace \
--set edition=k8s-ce:test \
--set pipelineBackend.image.tag=${PIPELINE_BACKEND_VERSION} \
--set connectorBackend.image.tag=${CONNECTOR_BACKEND_VERSION} \
--set controllerVDP.image.tag=${CONTROLLER_VDP_VERSION} \
--set tags.observability=false
kubectl rollout status deployment vdp-connector-backend --namespace instill-ai
kubectl rollout status deployment vdp-pipeline-backend --namespace instill-ai
kubectl rollout status deployment vdp-controller-vdp --namespace instill-ai
sleep 10
- name: Run ${{ inputs.component }} integration test (release)
env:
COMPONENT_VERSION: ${{ env[format('{0}_VERSION', steps.uppercase.outputs.COMPONENT_NAME)] }}
run: |
git clone -b v$COMPONENT_VERSION https://github.com/instill-ai/${{ inputs.component }}.git
cd ${{ inputs.component }}
make integration-test API_GATEWAY_URL=localhost:${API_GATEWAY_PORT}
helm-integration-test-release-mac:
if: inputs.target == 'release'
runs-on: [self-hosted,macOS,vdp]
steps:
- name: Set up environment
run: |
brew install make
- name: Checkout repo (vdp)
uses: actions/checkout@v3
with:
repository: instill-ai/vdp

- name: Load .env file (vdp)
uses: cardinalby/export-env-action@v2
with:
envFile: .env

- name: Check if VDP Helm release exists
id: check-vdp-helm-release
run: |
if helm ls -n instill-ai | grep -q 'vdp'; then
echo "Helm release 'vdp' found."
echo "release_exists=true" >> $GITHUB_OUTPUT
else
echo "Helm release 'vdp' not found."
fi
- name: Uninstall VDP Helm Release
if: steps.check-vdp-helm-release.outputs.release_exists == 'true'
run: |
helm uninstall vdp --namespace instill-ai
- name: Install k6
run: |
brew install k6
- name: Checkout repo
uses: actions/checkout@v3
with:
repository: instill-ai/base

- name: Load .env file
uses: cardinalby/export-env-action@v2
with:
envFile: .env

- name: Check if Base Helm release exists
id: check-base-helm-release
run: |
if helm ls -n instill-ai | grep -q 'base'; then
echo "Helm release 'base' found."
echo "release_exists=true" >> $GITHUB_OUTPUT
else
echo "Helm release 'base' not found."
fi
- name: Uninstall Base Helm Release
if: steps.check-base-helm-release.outputs.release_exists == 'true'
run: |
helm uninstall base --namespace instill-ai
kubectl delete namespace instill-ai
- name: Launch Helm Instill Base (release)
run: |
helm install base charts/base --namespace instill-ai --create-namespace \
--set edition=k8s-ce:test \
--set apiGateway.image.tag=${API_GATEWAY_VERSION} \
--set mgmtBackend.image.tag=${MGMT_BACKEND_VERSION} \
--set tags.observability=false \
--set tags.prometheusStack=false
- name: Wait for base pods up
run: |
while [[ $(kubectl get pods --namespace instill-ai -l "app.kubernetes.io/component=api-gateway,app.kubernetes.io/instance=base" -o 'jsonpath={..status.phase}') != *"Running"* ]]; do
echo "$(kubectl get pods --namespace instill-ai)"
sleep 10
done
- name: Port-forward of base-api-gateway
run: |
API_GATEWAY_POD_NAME=$(kubectl get pods --namespace instill-ai -l "app.kubernetes.io/component=api-gateway,app.kubernetes.io/instance=base" -o json | jq -r '.items[0].metadata.name')
kubectl --namespace instill-ai port-forward ${API_GATEWAY_POD_NAME} ${API_GATEWAY_PORT}:${API_GATEWAY_PORT} > /dev/null 2>&1 &
while ! nc -vz localhost ${API_GATEWAY_PORT} > /dev/null 2>&1; do sleep 1; done
- name: Checkout repo (vdp)
uses: actions/checkout@v3
with:
repository: instill-ai/vdp

- name: Load .env file (vdp)
uses: cardinalby/export-env-action@v2
with:
envFile: .env

- name: Uppercase component name
id: uppercase
run: |
echo "COMPONENT_NAME=$(echo ${{ inputs.component }} | tr 'a-z-' 'A-Z_')" >> $GITHUB_OUTPUT
- name: Launch Helm Instill VDP (release)
run: |
helm install vdp charts/vdp --namespace instill-ai --create-namespace \
Expand All @@ -208,4 +451,10 @@ jobs:
run: |
git clone -b v$COMPONENT_VERSION https://github.com/instill-ai/${{ inputs.component }}.git
cd ${{ inputs.component }}
make integration-test API_GATEWAY_URL=localhost:${API_GATEWAY_PORT}
make integration-test API_GATEWAY_URL=host.docker.internal:${API_GATEWAY_PORT}
- name: Uninstall Base and VDP Helm Release
run: |
helm uninstall vdp --namespace instill-ai
helm uninstall base --namespace instill-ai
kubectl delete namespace instill-ai
2 changes: 1 addition & 1 deletion .github/workflows/helm-integration-test-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
component: [pipeline-backend, connector-backend, controller-vdp]
uses: instill-ai/vdp/.github/workflows/helm-integration-test-backend.yml@main
uses: instill-ai/vdp/.github/workflows/helm-integration-test-backend.yml@sarthakgupta/ins-1586-create-integration-tests-cicd-for-mac-in-base-model-and-vdp
with:
component: ${{ matrix.component }}
target: latest
7 changes: 4 additions & 3 deletions .github/workflows/helm-integration-test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ on:
push:
branches:
- release-please--branches--main
tags:
- v*
- sarthakgupta/ins-1586-create-integration-tests-cicd-for-mac-in-base-model-and-vdp
# tags:
# - v*

jobs:
backend:
strategy:
fail-fast: false
matrix:
component: [pipeline-backend, connector-backend, controller-vdp]
uses: instill-ai/vdp/.github/workflows/helm-integration-test-backend.yml@main
uses: instill-ai/vdp/.github/workflows/helm-integration-test-backend.yml@sarthakgupta/ins-1586-create-integration-tests-cicd-for-mac-in-base-model-and-vdp
with:
component: ${{ matrix.component }}
target: release
Loading

0 comments on commit c00e77f

Please sign in to comment.