undo remaining changes #44
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: Build and test the operator | |
on: | |
push: | |
branches: | |
- 'master' | |
- 'release-*' | |
- 'rhos-*' | |
- 'operator-redesign' | |
pull_request: | |
branches: | |
- 'master' | |
- 'release-*' | |
- 'rhos-*' | |
- 'operator-redesign' | |
jobs: | |
build-operator: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create checkout directory | |
run: mkdir -p ~/go/src/github.com/argoproj-labs | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Create symlink in GOPATH | |
run: ln -s $(pwd) ~/go/src/github.com/argoproj-labs | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.20' | |
- name: Restore go build cache | |
uses: actions/cache@v1 | |
with: | |
path: ~/.cache/go-build | |
key: ${{ runner.os }}-go-build-v1-${{ github.run_id }} | |
- name: Build operator container image | |
run: make docker-build IMG=quay.io/argoprojlabs/argocd-operator:latest | |
test-e2e: | |
name: Run end-to-end tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
k3s-version: [ v1.27.1 ] | |
# k3s-version: [v1.20.2, v1.19.2, v1.18.9, v1.17.11, v1.16.15] | |
steps: | |
- name: Download kuttl plugin | |
env: | |
KUTTL_VERSION: '0.10.0' | |
KUTTL_PLUGIN_SUM: 'ad21c0d2be495a8f6cfc0821e592ae61afd191ebd453156d9b204e2524fceaf2' | |
KUTTL_PLUGIN_FILENAME: 'kubectl-kuttl_0.10.0_linux_x86_64' | |
run: | | |
set -x | |
echo ${KUTTL_PLUGIN_FILENAME} | |
curl -OL https://github.com/kudobuilder/kuttl/releases/download/v${KUTTL_VERSION}/${KUTTL_PLUGIN_FILENAME} | |
echo "${KUTTL_PLUGIN_SUM} ${KUTTL_PLUGIN_FILENAME}" | sha256sum -c - | |
sudo mv ${KUTTL_PLUGIN_FILENAME} /usr/local/bin/kubectl-kuttl | |
sudo chmod +x /usr/local/bin/kubectl-kuttl | |
kubectl-kuttl version | |
- name: Install K3D | |
run: | | |
set -x | |
curl -s https://raw.githubusercontent.com/rancher/k3d/main/install.sh | bash | |
sudo mkdir -p $HOME/.kube && sudo chown -R runner $HOME/.kube | |
k3d cluster create --servers 3 --image rancher/k3s:${{ matrix.k3s-version }}-k3s1 | |
kubectl version | |
k3d version | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Golang | |
uses: actions/setup-go@v1 | |
with: | |
go-version: '1.20' | |
- name: GH actions workaround - Kill XSP4 process | |
run: | | |
sudo pkill mono || true | |
- name: Restore go build cache | |
uses: actions/cache@v1 | |
with: | |
path: ~/.cache/go-build | |
key: ${{ runner.os }}-go-build-v1-${{ github.run_id }} | |
- name: Add /usr/local/bin to PATH | |
run: | | |
echo "/usr/local/bin" >> $GITHUB_PATH | |
- name: Download Go dependencies | |
run: | | |
go mod download | |
- name: Run the operator locally | |
env: | |
ARGOCD_CLUSTER_CONFIG_NAMESPACES: argocd-e2e-cluster-config | |
run: | | |
set -o pipefail | |
make install generate fmt vet | |
# Use tee to flush output to the log. Other solutions like stdbuf don't work, not sure why. | |
REDIS_CONFIG_PATH="build/redis" GRAFANA_CONFIG_PATH="grafana" go run ./main.go 2>&1 | tee /tmp/e2e-operator-run.log & | |
- name: Run tests | |
run: | | |
set -o pipefail | |
bash hack/test.sh 2>&1 | tee /tmp/e2e-test.log | |
- name: Upload operator logs | |
uses: actions/upload-artifact@v2 | |
with: | |
name: e2e-operator-run-${{ matrix.k3s-version }}.log | |
path: /tmp/e2e-operator-run.log | |
if: ${{ failure() }} | |
- name: Upload test logs | |
uses: actions/upload-artifact@v2 | |
with: | |
name: e2e-test-${{ matrix.k3s-version }}.log | |
path: /tmp/e2e-test.log | |
if: ${{ failure() }} | |
- name: Save application controller and server logs | |
if: ${{ failure() }} | |
run: | | |
# Since the tests stop on the first failure, only one of the namespaces will exist | |
set -x | |
if [ $(kubectl get namespaces -o=name | grep '^namespace/argocd-e2e$') ]; then | |
hack/pods.sh argocd-e2e > /tmp/pods.log | |
kubectl logs -n argocd-e2e $(kubectl get po -n argocd-e2e -o=name | grep example-argocd-application-controller) > /tmp/e2e-application-controller.log | |
kubectl logs -n argocd-e2e $(kubectl get po -n argocd-e2e -o=name | grep example-argocd-server) > /tmp/e2e-server.log | |
kubectl describe -n argocd-e2e $(kubectl get po -n argocd-e2e -o=name | grep example-argocd-server) >> /tmp/e2e-server.log | |
elif [ $(kubectl get namespaces -o=name | grep '^namespace/argocd-e2e-cluster-config$') ]; then | |
hack/pods.sh argocd-e2e-cluster-config > /tmp/pods.log | |
kubectl logs -n argocd-e2e-cluster-config $(kubectl get po -n argocd-e2e-cluster-config -o=name | grep example-argocd-application-controller) > /tmp/e2e-application-controller.log | |
kubectl logs -n argocd-e2e-cluster-config $(kubectl get po -n argocd-e2e-cluster-config -o=name | grep example-argocd-server) > /tmp/e2e-server.log | |
kubectl describe -n argocd-e2e-cluster-config $(kubectl get po -n argocd-e2e-cluster-config -o=name | grep example-argocd-server) >> /tmp/e2e-server.log | |
fi | |
- name: Upload application controller logs | |
uses: actions/upload-artifact@v2 | |
with: | |
name: e2e-application-controller-${{ matrix.k3s-version }}.log | |
path: /tmp/e2e-application-controller.log | |
if: ${{ failure() }} | |
- name: Upload server logs | |
uses: actions/upload-artifact@v2 | |
with: | |
name: e2e-server-${{ matrix.k3s-version }}.log | |
path: /tmp/e2e-server.log | |
if: ${{ failure() }} | |
- name: Upload pod descriptions | |
uses: actions/upload-artifact@v2 | |
with: | |
name: e2e-pods-${{ matrix.k3s-version }}.log | |
path: /tmp/pods.log | |
if: ${{ failure() }} |