This repository has been archived by the owner on Nov 29, 2024. It is now read-only.
-
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.
* CI init * Cleanup * Set up baseline namespace * Fix pods check * Add lint test * Add lint test
- Loading branch information
1 parent
c0da31c
commit b5b0e87
Showing
12 changed files
with
534 additions
and
76 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,29 @@ | ||
name: cleanup caches by a branch | ||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
cleanup: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Cleanup | ||
run: | | ||
gh extension install actions/gh-actions-cache | ||
echo "Fetching list of cache key" | ||
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) | ||
## Setting this to not fail the workflow while deleting cache keys. | ||
set +e | ||
echo "Deleting caches..." | ||
for cacheKey in $cacheKeysForPR | ||
do | ||
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm | ||
done | ||
echo "Done" | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
REPO: ${{ github.repository }} | ||
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge |
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,48 @@ | ||
name: Check and build Kardinal Operator | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- "v*.*.*" | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
check_go: | ||
name: Check Go | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '^1.22.0' | ||
|
||
- name: Check Go formatting | ||
run: | | ||
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then | ||
exit 1 | ||
fi | ||
build: | ||
name: Build | ||
needs: [check_go] | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build operator binary | ||
run: make build | ||
|
||
- name: Linter | ||
run: make lint |
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,67 @@ | ||
name: Tests | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- "v*.*.*" | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
tests: | ||
name: Tests | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Start minikube | ||
uses: manusa/[email protected] | ||
id: minikube | ||
with: | ||
minikube version: "v1.33.0" | ||
kubernetes version: "v1.30.0" | ||
driver: docker | ||
start args: --embed-certs --addons=ingress,metrics-server | ||
|
||
- name: Install Istio | ||
run: | | ||
ISTIO_VERSION="1.23.0" | ||
echo "Installing Istio ..." | ||
mkdir istio_tmp | ||
pushd istio_tmp >/dev/null | ||
curl -L https://istio.io/downloadIstio | ISTIO_VERSION=${ISTIO_VERSION} sh - | ||
cd istio-${ISTIO_VERSION} | ||
export PATH=$PWD/bin:$PATH | ||
istioctl install --set profile=demo -y | ||
popd | ||
- name: Deploy the boutique demo | ||
run: | | ||
kubectl create namespace baseline | ||
kubectl apply -f ci/obd-demo.yaml -n baseline | ||
- name: Validate that the boutique demo is up and running | ||
run: | | ||
# Check that the four baseline service pods are running and ready | ||
while [ $(kubectl get pods -n baseline --no-headers -o custom-columns=NAMESPACE:metadata.namespace,POD:metadata.name,PodIP:status.podIP,READY-true:status.containerStatuses[*].ready | grep "true" | wc -l) -ne 4 ] | ||
do | ||
echo "Waiting for baseline pods to run..." | ||
kubectl get pods -n baseline -o custom-columns=NAMESPACE:metadata.namespace,POD:metadata.name,PodIP:status.podIP,READY-true:status.containerStatuses[*].ready | ||
((c++)) && ((c==12)) && exit 1 | ||
sleep 10 | ||
done | ||
apps=$(kubectl get pods -n baseline -o custom-columns=:metadata.labels.app | tr " " "\n" | sort -g | tr "\n" " " | xargs) | ||
echo ${apps} | ||
if [ "${apps}" != "cartservice frontend postgres productcatalogservice" ]; then exit 1; fi | ||
- name: Run operator tests | ||
run: | | ||
make test |
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 @@ | ||
# Check PR title for conventional commits | ||
name: Check PR title | ||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- reopened | ||
- edited | ||
- synchronize | ||
|
||
# cancel redundant builds | ||
concurrency: | ||
group: "title-checker-${{ github.head_ref }}" | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
title_check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: amannn/action-semantic-pull-request@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
Oops, something went wrong.