Skip to content

[main] Update golang 1.22 #51

[main] Update golang 1.22

[main] Update golang 1.22 #51

name: "[prom-fed] E2E CI"
on:
workflow_dispatch:
inputs:
debug:
description: "Enable debug logs"
required: false
default: "false"
k3s_version:
description: "Version of k3s to use for the underlying cluster, should exist in https://hub.docker.com/r/rancher/k3s/tags"
required: false
pull_request:
paths-ignore:
- 'docs/**'
- 'scripts/**'
- '*.md'
- '*.dapper'
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
- 'Makefile'
push:
branches:
- main
paths-ignore:
- 'docs/**'
- '*.md'
- 'CODEOWNERS'
- 'LICENSE'
env:
GOARCH: amd64
CGO_ENABLED: 0
SETUP_GO_VERSION: '^1.20'
YQ_VERSION: v4.25.1
E2E_CI: true
REPO: rancher
APISERVER_PORT: 8001
DEFAULT_SLEEP_TIMEOUT_SECONDS: 10
KUBECTL_WAIT_TIMEOUT: 300s
DEBUG: ${{ github.event.inputs.debug || false }}
CLUSTER_NAME: 'e2e-ci-prometheus-federator'
permissions:
contents: write
jobs:
prebuild-env:
name: Prebuild needed Env vars
strategy:
matrix:
arch:
- x64
- arm64
runs-on : runs-on,image=ubuntu22-full-${{ matrix.arch }},runner=4cpu-linux-${{ matrix.arch }},run-id=${{ github.run_id }}
steps:
- name: Check out the repository to the runner
uses: actions/checkout@v4
- name: Set Branch Tag and Other Variables
id: set-vars
run: bash ./.github/scripts/branch-tags.sh >> $GITHUB_OUTPUT
outputs:
branch_tag: ${{ steps.set-vars.outputs.branch_tag }}
branch_static_tag: ${{ steps.set-vars.outputs.branch_static_tag }}
prev_tag: ${{ steps.set-vars.outputs.prev_tag }}
e2e-prometheus-federator:
needs: [
prebuild-env,
]
strategy:
matrix:
arch:
- x64
- arm64
k3s_version:
# k3d version list k3s | sed 's/+/-/' | sort -h
- ${{ github.event.inputs.k3s_version || 'v1.28.14-k3s1' }}
runs-on : runs-on,image=ubuntu22-full-${{ matrix.arch }},runner=4cpu-linux-${{ matrix.arch }},run-id=${{ github.run_id }}
env:
TAG: ${{ needs.prebuild-env.outputs.branch_static_tag }}
steps:
-
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: '>=1.20.0'
- uses: azure/setup-kubectl@v3
- uses: azure/setup-helm@v3
with:
version: v3.11.1
-
name: Install mikefarah/yq
run: |
sudo wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_${{ matrix.arch == 'x64' && 'amd64' || matrix.arch }} -O /usr/bin/yq && sudo chmod +x /usr/bin/yq;
-
name: Perform pre-e2e image build
run: |
EMBEDED_CHART_VERSION=0.3.4 REPO=${REPO} TAG=${TAG} make build;
REPO=${REPO} TAG=${TAG} make package;
-
name : Install k3d
run : ./.github/workflows/e2e/scripts/install-k3d.sh
-
name : Setup k3d cluster
run : K3S_VERSION=${{ matrix.k3s_version }} ./.github/workflows/e2e/scripts/setup-cluster.sh
-
name: Import Images Into k3d
run: |
k3d image import ${REPO}/prometheus-federator:${TAG} -c $CLUSTER_NAME;
-
name: Setup kubectl context
run: |
kubectl config use-context "k3d-$CLUSTER_NAME";
-
name: Install Rancher Monitoring
run: ./.github/workflows/e2e/scripts/install-monitoring.sh;
-
name: Check if Rancher Monitoring is up
run: ./.github/workflows/e2e/scripts/validate-monitoring.sh;
-
name: Install Prometheus Federator
run: ./.github/workflows/e2e/scripts/install-federator.sh;
-
name: Check if Prometheus Federator is up
run: ./.github/workflows/e2e/scripts/validate-federator.sh;
-
name: Check if Project Registration Namespace is auto-created on namespace detection
run: ./.github/workflows/e2e/scripts/create-project-namespace.sh;
-
name: Create Project Monitoring Stack via ProjectHelmChart CR
run: DEFAULT_SLEEP_TIMEOUT_SECONDS=20 ./.github/workflows/e2e/scripts/create-projecthelmchart.sh;
-
name: Check if the Project Prometheus Stack is up
run: ./.github/workflows/e2e/scripts/validate-project-monitoring.sh;
-
name: Wait for 8 minutes for enough scraping to be done to continue
run: |
for i in {1..48}; do sleep 10; echo "Waited $((i*10)) seconds for metrics to be populated"...; done;
-
name: Validate Project Prometheus Targets
run: ./.github/workflows/e2e/scripts/validate-project-prometheus-targets.sh;
-
name: Validate Project Grafana Datasources
run: ./.github/workflows/e2e/scripts/validate-project-grafana-datasource.sh;
-
name: Validate Project Grafana Dashboards
run: ./.github/workflows/e2e/scripts/validate-project-grafana-dashboards.sh;
# Re-disable this as it's been broken since Jun 28, 2023
# More context: https://github.com/rancher/prometheus-federator/pull/73
# -
# name: Validate Project Grafana Dashboard Data
# run: ./.github/workflows/e2e/scripts/validate-project-grafana-dashboard-data.sh;
-
name: Validate Project Prometheus Alerts
run: ./.github/workflows/e2e/scripts/validate-project-prometheus-alerts.sh;
-
name: Validate Project Alertmanager
run: ./.github/workflows/e2e/scripts/validate-project-alertmanager.sh;
-
name: Delete Project Prometheus Stack
run: ./.github/workflows/e2e/scripts/delete-projecthelmchart.sh;
-
name: Uninstall Prometheus Federator
run: ./.github/workflows/e2e/scripts/uninstall-federator.sh;
- name: Generate artifacts on failure
if: failure()
run: ./.github/workflows/e2e/scripts/generate-artifacts.sh;
- name: Upload logs and manifests on failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: artifacts-${{ matrix.arch }}-${{ matrix.k3s_version }}
path: artifacts/
retention-days: 1
-
name: Delete k3d cluster
if: always()
run: k3d cluster delete e2e-ci-prometheus-federator