Skip to content

Commit

Permalink
fix helm project-operator CI
Browse files Browse the repository at this point in the history
ammend build CI to not use dapper

Signed-off-by: Alexandre Lamarre <[email protected]>
  • Loading branch information
alexandreLamarre committed Apr 2, 2024
1 parent e84c013 commit ae2c53b
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 19 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/e2e-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ on:
env:
GOARCH: amd64
CGO_ENABLED: 0
SETUP_GO_VERSION: '^1.18'
SETUP_GO_VERSION: '^1.22'
YQ_VERSION: v4.25.1
E2E_CI: true
REPO: rancher
TAG: dev
APISERVER_PORT: 8001
DEFAULT_SLEEP_TIMEOUT_SECONDS: 10
DEFAULT_SLEEP_TIMEOUT_SECONDS: 60
KUBECTL_WAIT_TIMEOUT: 120s
DEBUG: ${{ github.event.inputs.debug || false }}

Expand All @@ -48,7 +48,7 @@ jobs:
matrix:
k3s_version:
# k3d version list k3s | sed 's/+/-/' | sort -h
- ${{ github.event.inputs.k3s_version || 'v1.20.15-k3s1' }}
- ${{ github.event.inputs.k3s_version || 'v1.27.7-k3s2' }}
steps:
-
uses: actions/checkout@v3
Expand All @@ -58,6 +58,11 @@ jobs:
name: Install mikefarah/yq
run: |
sudo wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64 -O /usr/bin/yq && sudo chmod +x /usr/bin/yq;
-
name: setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
-
name: Perform CI
run: |
Expand Down Expand Up @@ -94,6 +99,12 @@ jobs:
-
name: Check if Helm Project Operator is up
run: ./.github/workflows/e2e/scripts/validate-helm-project-operator.sh;
-
name: Install rancher manager
run: ./.github/workflows/e2e/scripts/install-rancher.sh;
-
name: Validate rancher manager
run: ./.github/workflows/e2e/scripts/validate-rancher.sh;
-
name: Check if Project Registration Namespace is auto-created on namespace detection
run: ./.github/workflows/e2e/scripts/create-project-namespace.sh;
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/e2e/scripts/create-project-namespace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ source $(dirname $0)/entry
cd $(dirname $0)/../../../..

kubectl create namespace e2e-hpo || true
kubectl label namespace e2e-hpo field.cattle.io/projectId=p-example --overwrite
kubectl annotate namespace e2e-hpo field.cattle.io/projectId=local:p-example --overwrite
sleep "${DEFAULT_SLEEP_TIMEOUT_SECONDS}"
if ! kubectl get namespace cattle-project-p-example; then
echo "DEBUG"
kubectl get ns
echo "ERROR: Expected cattle-project-p-example namespace to exist after ${DEFAULT_SLEEP_TIMEOUT_SECONDS} seconds, not found"
exit 1
fi
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/e2e/scripts/install-rancher.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -e

helm repo add rancher-stable https://releases.rancher.com/server-charts/stable

helm repo update

kubectl create namespace cattle-system

helm install -n cattle-system rancher rancher-stable/rancher
17 changes: 17 additions & 0 deletions .github/workflows/e2e/scripts/validate-rancher.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
set -e

sleep "${DEFAULT_SLEEP_TIMEOUT_SECONDS}"
# Check deployment status
kubectl -n cattle-system rollout status deploy/rancher

# Capture the exit status of the previous command
exit_status=$?

if [ $exit_status -eq 0 ]; then
echo "rancher deployment is healthy."
else
echo "rancher deployment is not healthy."
fi

exit $exit_status
18 changes: 13 additions & 5 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,17 @@ on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
container:
image: rancher/dapper:v0.5.4
steps:
- uses: actions/checkout@v1
- name: Run CI
run: dapper ci
-
name : setup go
uses: actions/setup-go@v5
with:
go-version: '1.22'
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
uses: actions/checkout@v1
-
name: Run CI
run: make ci
13 changes: 3 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
TARGETS := $(shell ls scripts)

.dapper:
@echo Downloading dapper
@curl -sL https://releases.rancher.com/dapper/latest/dapper-$$(uname -s)-$$(uname -m) > .dapper.tmp
@@chmod +x .dapper.tmp
@./.dapper.tmp -v
@mv .dapper.tmp .dapper

$(TARGETS): .dapper
./.dapper $@
$(TARGETS):
./scripts/$@

.DEFAULT_GOAL := default

.PHONY: $(TARGETS)
.PHONY: $(TARGETS)

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ae2c53b

Please sign in to comment.