Avoid using go routines in reconcile function (#148) #470
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
name: Test Incoming Changes | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
env: | |
CM_BIN: /usr/local/bin/checkmake | |
CM_URL_LINUX: https://github.com/mrtazz/checkmake/releases/download/0.2.2/checkmake-0.2.2.linux.amd64 # yamllint disable-line | |
jobs: | |
lint: | |
name: Run Linters and Vet | |
runs-on: ubuntu-22.04 | |
env: | |
SHELL: /bin/bash | |
steps: | |
- name: Set up Go 1.23 | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.23.4 | |
- name: Disable default go problem matcher | |
run: echo "::remove-matcher owner=go::" | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.sha }} | |
- name: Extract dependent Pull Requests | |
uses: depends-on/depends-on-action@main | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install checkmake | |
run: | | |
curl --location --output $CM_BIN --silent $CM_URL_LINUX | |
chmod +x $CM_BIN | |
- name: Install Shfmt | |
uses: mfinelli/setup-shfmt@v3 | |
- name: Golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: v1.62 | |
args: --timeout 10m0s | |
- name: Checkmake | |
run: checkmake --config=.checkmake Makefile | |
- name: Hadolint | |
uses: hadolint/[email protected] | |
with: | |
dockerfile: Dockerfile | |
recursive: true | |
# - name: Shfmt | |
# run: shfmt -d *.sh script | |
- name: Markdownlint | |
uses: nosborn/[email protected] | |
with: | |
files: . | |
- name: ShellCheck | |
uses: ludeeus/action-shellcheck@master | |
- name: Typos | |
uses: crate-ci/typos@master | |
- name: Yamllint | |
uses: ibiqlik/action-yamllint@v3 | |
with: | |
config_file: .yamllint.yml | |
- name: Go vet | |
run: make vet | |
test: | |
name: Build, install and test operator in a Kind cluster | |
runs-on: ubuntu-22.04 | |
env: | |
SHELL: /bin/bash | |
KUBECONFIG: '/home/runner/.kube/config' | |
steps: | |
- name: Disable default go problem matcher | |
run: echo "::remove-matcher owner=go::" | |
# Restart docker using /mnt/docker-storage (sdb) instead of /var/lib/docker (sda). | |
- name: Make docker to use /mnt (sdb) for storage | |
run: | | |
df -h | |
lsblk | |
sudo mkdir /mnt/docker-storage | |
sudo jq '. +={"data-root" : "/mnt/docker-storage"}' < /etc/docker/daemon.json > /tmp/docker-daemon.json | |
sudo cp /tmp/docker-daemon.json /etc/docker/daemon.json | |
cat /etc/docker/daemon.json | |
sudo systemctl restart docker | |
sudo ls -la /mnt/docker-storage | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.sha }} | |
- name: Build operator | |
run: ./scripts/ci/build.sh | |
- name: Removed unused docker images and go cache cleanup | |
run: | | |
df -h | |
docker rmi $(docker images -f "dangling=true" -q) || true | |
docker builder prune --all -f | |
go clean -modcache | |
df -h | |
# Create a Kind cluster for testing. | |
- name: Check out `certsuite-sample-workload` repo | |
uses: actions/checkout@v4 | |
with: | |
repository: redhat-best-practices-for-k8s/certsuite-sample-workload | |
path: certsuite-sample-workload | |
- name: Bootstrap cluster, docker, and python | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 5 | |
max_attempts: 3 | |
command: cd ${GITHUB_WORKSPACE}/certsuite-sample-workload; make bootstrap-cluster && make bootstrap-docker-ubuntu-local && make bootstrap-python-ubuntu-local | |
# Restart docker using /mnt/docker-storage (sdb) instead of /var/lib/docker (sda). | |
# This step needs to be done right after the sample workload repo's bootstrap scripts, as they | |
# overwrite the docker's daemon.json. | |
- name: Make docker to use /mnt (sdb) for storage | |
run: | | |
df -h | |
lsblk | |
sudo mkdir /mnt/docker-storage || true | |
sudo jq '. +={"data-root" : "/mnt/docker-storage"}' < /etc/docker/daemon.json > /tmp/docker-daemon.json | |
sudo cp /tmp/docker-daemon.json /etc/docker/daemon.json | |
cat /etc/docker/daemon.json | |
sudo systemctl restart docker | |
sudo ls -la /mnt/docker-storage | |
- name: Run 'make rebuild-cluster' | |
uses: nick-fields/retry@v3 | |
env: | |
SKIP_PRELOAD_IMAGES: true | |
with: | |
timeout_minutes: 15 | |
max_attempts: 3 | |
command: cd ${GITHUB_WORKSPACE}/certsuite-sample-workload; make rebuild-cluster | |
- name: Run 'make install' | |
uses: nick-fields/retry@v3 | |
env: | |
SKIP_PRELOAD_IMAGES: true | |
with: | |
timeout_minutes: 20 | |
max_attempts: 3 | |
command: cd ${GITHUB_WORKSPACE}/certsuite-sample-workload; make install | |
- name: Install cert-manager to cluster | |
run: | | |
kubectl apply -f https://github.com/jetstack/cert-manager/releases/latest/download/cert-manager.yaml | |
kubectl wait --for=condition=ready pod --all=true -n cert-manager --timeout=5m | |
- name: Install consoleplugin CRD to cluster | |
run: | | |
kubectl apply -f https://raw.githubusercontent.com/openshift/api/master/console/v1/zz_generated.crd-manifests/90_consoleplugins-Default.crd.yaml | |
- name: More cleanup | |
run: | | |
df -h | |
docker rmi $(docker images -f "dangling=true" -q) || true | |
docker builder prune --all -f | |
go clean -modcache | |
rm -rf ${GITHUB_WORKSPACE}/certsuite-sample-workload | |
df -h | |
- name: Install operator in the Kind cluster | |
run: ./scripts/ci/deploy.sh | |
- name: Run simple smoke test. | |
run: ./scripts/ci/smoke_test.sh |