forked from shipwright-io/cli
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setting up end-to-end test environment.
- Loading branch information
Showing
6 changed files
with
158 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
name: End-to-End (E2E) Tests | ||
jobs: | ||
e2e: | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
kubernetes: | ||
- v1.20.7 | ||
max-parallel: 1 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ^1.16 | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Tools | ||
run: sudo apt-get update && sudo apt-get install -y make gcc | ||
|
||
- name: Setup BATS | ||
uses: mig4/setup-bats@v1 | ||
with: | ||
bats-version: 1.2.1 | ||
|
||
- name: Install kubectl | ||
uses: azure/setup-kubectl@v1 | ||
with: | ||
version: ${{ matrix.kubernetes }} | ||
|
||
- name: Create KinD cluster | ||
uses: helm/kind-action@v1.2.0 | ||
with: | ||
version: v0.11.1 | ||
node_image: kindest/node:${{ matrix.kubernetes }} | ||
cluster_name: kind | ||
wait: 120s | ||
|
||
- name: Verify KinD cluster | ||
run: make verify-kind | ||
|
||
- name: Installing Shipwright Build Controller | ||
run: make install-shipwright | ||
|
||
- name: Build Application (shp) | ||
run: make build | ||
|
||
- name: End-to-End Tests | ||
run: make test-e2e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Installs Shipwright Build Controller and Build-Strategies. | ||
# | ||
|
||
set -eu | ||
|
||
SHIPWRIGHT_HOST="github.com" | ||
SHIPWRIGHT_HOST_PATH="shipwright-io/build/releases/download" | ||
SHIPWRIGHT_VERSION="${SHIPWRIGHT_VERSION:-v0.5.1}" | ||
|
||
echo "# Deploying Shipwright Controller '${SHIPWRIGHT_VERSION}'" | ||
|
||
kubectl apply -f "https://${SHIPWRIGHT_HOST}/${SHIPWRIGHT_HOST_PATH}/${SHIPWRIGHT_VERSION}/release.yaml" | ||
|
||
echo "# Waiting for Build Controller rollout..." | ||
|
||
kubectl --namespace="shipwright-build" rollout status deployment shipwright-build-controller --timeout=1m | ||
|
||
echo "# Installing upstream Build-Strategies..." | ||
|
||
kubectl apply -f "https://${SHIPWRIGHT_HOST}/${SHIPWRIGHT_HOST_PATH}/nightly/default_strategies.yaml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Installs Tekton Pipelines. | ||
# | ||
|
||
set -eu | ||
|
||
TEKTON_VERSION="${TEKTON_VERSION:-v0.25.0}" | ||
|
||
TEKTON_HOST="github.com" | ||
TEKTON_HOST_PATH="tektoncd/pipeline/releases/download" | ||
|
||
function rollout_status () { | ||
kubectl --namespace="tekton-pipelines" rollout status deployment ${1} --timeout=1m | ||
} | ||
|
||
echo "# Deploying Tekton Pipelines '${TEKTON_VERSION}'" | ||
|
||
kubectl apply -f "https://${TEKTON_HOST}/${TEKTON_HOST_PATH}/${TEKTON_VERSION}/release.yaml" | ||
|
||
echo "# Waiting for Tekton components..." | ||
|
||
rollout_status "tekton-pipelines-controller" | ||
rollout_status "tekton-pipelines-webhook" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Make sure a KinD instance is up and running. | ||
# | ||
|
||
set -eu | ||
|
||
function node_status () { | ||
echo $(kubectl get node kind-control-plane -o json | \ | ||
jq -r .'status.conditions[] | select(.type == "Ready") | .status') | ||
} | ||
|
||
echo "# Using KinD context..." | ||
kubectl config use-context "kind-kind" | ||
|
||
echo "# KinD nodes:" | ||
kubectl get nodes | ||
|
||
if [ "$(node_status)" == "True" ]; then | ||
echo "# Kind is Ready!" | ||
else | ||
echo "# Node is not ready:" | ||
kubectl describe node kind-control-plane | ||
|
||
echo "# Pods:" | ||
kubectl get pod -A | ||
echo "# Events:" | ||
kubectl get events -A | ||
|
||
exit 1 | ||
fi |