generated from crossplane/provider-template
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from stevendborrelli/github-ci
Add Github CI actions for kafka cluster
- Loading branch information
Showing
2 changed files
with
88 additions
and
11 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 |
---|---|---|
|
@@ -13,6 +13,11 @@ env: | |
GO_VERSION: '1.17' | ||
GOLANGCI_VERSION: 'v1.31' | ||
DOCKER_BUILDX_VERSION: 'v0.4.2' | ||
KIND_VERSION: 'v0.12.0' | ||
HELM_VERSION: 'v3.8.1' | ||
CROSSPLANE_VERSION: 'stable' | ||
KUBECTL_VERSION: 'v1.23.4' | ||
KUBEFWD_VERSION: '1.22.0' | ||
|
||
# Common users. We can't run a step 'if secrets.AWS_USR != ""' but we can run | ||
# a step 'if env.AWS_USR' != ""', so we copy these to succinctly test whether | ||
|
@@ -167,7 +172,74 @@ jobs: | |
- name: Vendor Dependencies | ||
run: make vendor vendor.check | ||
|
||
- name: Set up Kind Cluster | ||
uses: helm/[email protected] | ||
with: | ||
version: ${{ env.KIND_VERSION }} | ||
cluster_name: 'kafka' | ||
|
||
- name: Install Crossplane | ||
run: | | ||
kubectl create ns crossplane-system | ||
helm repo add crossplane-stable https://charts.crossplane.io/stable | ||
helm repo update | ||
helm install crossplane --namespace crossplane-system crossplane-stable/crossplane | ||
- name: Install Provider-Kafka CRDs | ||
run: kubectl apply -f package/crds | ||
|
||
- name: Install Kafka | ||
run: | | ||
helm repo add bitnami https://charts.bitnami.com/bitnami | ||
kubectl create ns kafka-cluster | ||
helm upgrade --install kafka-dev -n kafka-cluster bitnami/kafka \ | ||
--version 15.0.1 \ | ||
--set auth.clientProtocol=sasl \ | ||
--set deleteTopicEnable=true \ | ||
--set authorizerClassName="kafka.security.authorizer.AclAuthorizer" \ | ||
--wait | ||
- name: Get Kafka Client Password | ||
id: kafka | ||
run: echo "::set-output name=password::$(kubectl get secret kafka-dev-jaas --namespace kafka-cluster -o jsonpath='{.data.client-passwords}' | base64 --decode | cut -d , -f 1)" | ||
|
||
- name: Create Kafka Credentials File | ||
env: | ||
KAFKA_PASSWORD: ${{ steps.kafka.outputs.password }} | ||
run: | | ||
echo "{ | ||
"brokers": [ | ||
"kafka-dev-0.kafka-dev-headless:9092" | ||
], | ||
"sasl": { | ||
"mechanism": "PLAIN", | ||
"username": "user", | ||
"password": "${KAFKA_PASSWORD}" | ||
} | ||
}" > kc.json | ||
- name: Show kc.json file | ||
run: cat kc.json | ||
|
||
- name: create Kafka K8s secret | ||
run: kubectl -n kafka-cluster create secret generic kafka-creds --from-file=credentials=kc.json | ||
|
||
|
||
- name: Test downloading external binary | ||
uses: giantswarm/[email protected] | ||
with: | ||
binary: "kubefwd" | ||
version: "${{ env.KUBEFWD_VERSION }}" | ||
download_url: "https://github.com/txn2/kubefwd/releases/download/${version}/${binary}_Linux_x86_64.tar.gz" | ||
tarball_binary_path: "${binary}" | ||
smoke_test: "${binary} version" | ||
|
||
- name: run Kubefwd | ||
run: sudo -E /opt/hostedtoolcache/kubefwd/${{ env.KUBEFWD_VERSION }}/x64/kubefwd svc -n kafka-cluster & | ||
|
||
- name: Run Unit Tests | ||
env: | ||
KAFKA_PASSWORD: ${{ steps.kafka.outputs.password }} | ||
run: make -j2 test | ||
|
||
- name: Publish Unit Test Coverage | ||
|
@@ -235,8 +307,8 @@ jobs: | |
# builds by default. Specifying --load does so. | ||
BUILD_ARGS: "--load" | ||
|
||
- name: Run E2E Tests | ||
run: make e2e USE_HELM3=true | ||
# - name: Run E2E Tests | ||
# run: make e2e USE_HELM3=true | ||
|
||
publish-artifacts: | ||
runs-on: ubuntu-18.04 | ||
|
@@ -324,4 +396,4 @@ jobs: | |
BRANCH_NAME: main | ||
CHANNEL: main | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_USR }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PSW }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PSW }} |
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