test acorn on EKS #394
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 acorn on EKS | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '00 7 * * *' # time in UTC | |
jobs: | |
acorn-test-eks: | |
runs-on: ["self-hosted", "gha-eks"] | |
permissions: | |
id-token: write | |
steps: | |
- name: install curl | |
run: | | |
sudo apt update | |
sudo apt install -y curl build-essential make | |
curl -LO https://dl.k8s.io/release/v1.25.0/bin/linux/amd64/kubectl | |
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl | |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | |
unzip awscliv2.zip | |
sudo ./aws/install | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-go@v4 | |
with: | |
cache: false | |
go-version: "1.20" | |
- run: make validate-code | |
- run: make build | |
- run: sudo install -o root -g root -m 0755 ./bin/acorn /usr/local/bin/acorn | |
- name: configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.GHA_SVC_ACC_AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.GHA_SVC_ACC_AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.GHA_SVC_ACC_AWS_REGION }} | |
- name: update kubeconfig | |
run: | | |
aws eks update-kubeconfig --region ${{ secrets.GHA_SVC_ACC_AWS_REGION }} --name ${{ secrets.GHA_SVC_ACC_EKS_CLUSTER_NAME }} | |
- name: install acorn | |
# If a previous run left Acorn installed, uninstall it | |
run: | | |
if acorn check; then | |
acorn uninstall -af | |
fi | |
# Install Acorn with NetworkPolicies disabled because EKS does not enforce them, so tests will fail if we leave them enabled | |
acorn install --image ghcr.io/acorn-io/acorn:main --network-policies=false | |
env: | |
KUBECONFIG: "/home/runner/.kube/config" | |
- name: run acorn integration tests | |
run: | | |
make TEST_ACORN_CONTROLLER=external TEST_FLAGS="-timeout=7m" test | |
env: | |
KUBECONFIG: "/home/runner/.kube/config" | |
- name: report failure to slack | |
if: failure() | |
id: slack-failure | |
uses: slackapi/[email protected] | |
with: | |
channel-id: '${{ secrets.SLACK_BOT_FAILURE_CHANNEL }}' | |
slack-message: "❌ Nightly EKS test failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
- name: report success to slack | |
id: slack-success | |
uses: slackapi/[email protected] | |
with: | |
channel-id: '${{ secrets.SLACK_BOT_SUCCESS_CHANNEL }}' | |
slack-message: " ✅ Nightly EKS test passed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
env: | |
SLACK_BOT_TOKEN: '${{ secrets.SLACK_BOT_TOKEN }}' | |
- name: create run artifacts | |
if: always() | |
# Add any artifacts that should be associated with this run to /tmp/artifacts/${{ github.run_id }} | |
run: | | |
mkdir -p /tmp/artifacts/${{ github.run_id }}/{logs,resources} | |
kubectl logs -n acorn-system -l app=acorn-api --tail -1 > /tmp/artifacts/${{ github.run_id }}/logs/acorn-api.log || true | |
kubectl logs -n acorn-system -l app=acorn-controller --tail -1 > /tmp/artifacts/${{ github.run_id }}/logs/acorn-controller.log || true | |
kubectl get all -n acorn-image-system > /tmp/artifacts/${{ github.run_id }}/resources/acorn-image-system.txt || true | |
kubectl get all -n acorn-system > /tmp/artifacts/${{ github.run_id }}/resources/acorn-system.txt || true | |
kubectl get all -n acorn > /tmp/artifacts/${{ github.run_id }}/resources/acorn.txt || true | |
acorn all -A > /tmp/artifacts/${{ github.run_id }}/resources/acorn-resources-state.txt || true | |
- name: upload run artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: run-artifacts | |
path: /tmp/artifacts/${{ github.run_id }}/ | |
# Only uninstall on success, keep around on failure for debugging | |
- name: uninstall acorn | |
if: success() | |
run: | | |
acorn uninstall -af | |
env: | |
KUBECONFIG: "/home/runner/.kube/config" |