chore(deps): update actions/checkout action to v4 #150
Workflow file for this run
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: Helm Chart CI - Resource Discovery Agent | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
paths: | |
- '.github/workflows/ci-agent-resource-discovery.yml' | |
- 'promitor-agent-resource-discovery/**' | |
jobs: | |
lint-helm-3-x: | |
name: Lint Helm Chart | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Helm install | |
uses: Azure/setup-helm@v3 | |
- name: Lint Promitor Resource Discovery Helm chart | |
run: helm lint promitor-agent-resource-discovery --values examples/promitor-agent-resource-discovery.config.yaml | |
deploy-helm-3-x: | |
name: Deploy to Kubernetes ${{ matrix.kubernetesVersion }} (Kind) | |
needs: [lint-helm-3-x] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
kubernetesVersion: [v1.27, v1.26, v1.25, v1.24] | |
include: | |
# Images are defined on every Kind release | |
# See https://github.com/kubernetes-sigs/kind/releases | |
- kubernetesVersion: v1.27 | |
kindImage: kindest/node:v1.27.3@sha256:3966ac761ae0136263ffdb6cfd4db23ef8a83cba8a463690e98317add2c9ba72 | |
- kubernetesVersion: v1.26 | |
kindImage: kindest/node:v1.26.6@sha256:6e2d8b28a5b601defe327b98bd1c2d1930b49e5d8c512e1895099e4504007adb | |
- kubernetesVersion: v1.25 | |
kindImage: kindest/node:v1.25.11@sha256:227fa11ce74ea76a0474eeefb84cb75d8dad1b08638371ecf0e86259b35be0c8 | |
- kubernetesVersion: v1.24 | |
kindImage: kindest/node:v1.24.15@sha256:7db4f8bea3e14b82d12e044e25e34bd53754b7f2b0e9d56df21774e6f66a70ab | |
env: | |
kubernetes_namespace: promitor | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Helm install | |
uses: Azure/setup-helm@v3 | |
- name: Create k8s ${{ matrix.kubernetesVersion }} Kind Cluster | |
uses: helm/[email protected] | |
with: | |
node_image: ${{ matrix.kindImage }} | |
- name: Show Kubernetes version | |
run: | | |
kubectl version | |
- name: Show Kubernetes nodes | |
run: | | |
kubectl get nodes -o wide | |
- name: Show Helm version | |
run: | | |
helm version | |
- name: Create Promitor namespace | |
run: kubectl create ns ${{ env.kubernetes_namespace }} | |
- name: Change Kubernetes context to use Promitor namespace | |
run: kubectl config set-context --current --namespace=${{ env.kubernetes_namespace }} | |
- name: Template Helm chart | |
run: helm template promitor-agent-resource-discovery ./promitor-agent-resource-discovery/ --values examples/promitor-agent-resource-discovery.config.yaml | |
- name: Install Helm chart | |
run: helm install promitor-agent-resource-discovery ./promitor-agent-resource-discovery/ --values examples/promitor-agent-resource-discovery.config.yaml --wait | |
- name: Wait for Kubernetes workload to spin up | |
run: sleep 30s | |
shell: bash | |
- name: Show installed Helm charts | |
run: helm ls | |
if: always() | |
- name: Show Kubernetes resources | |
run: kubectl get all | |
if: always() | |
- name: Show Pod Logs | |
run: | | |
CONTAINER_RESTART_COUNT=$(kubectl get pod -l app.kubernetes.io/name=promitor-agent-resource-discovery -o=jsonpath='{.items[0].status.containerStatuses[0].restartCount}') | |
kubectl logs -l app.kubernetes.io/name=promitor-agent-resource-discovery | |
echo "Current container logs" | |
kubectl logs -l app.kubernetes.io/name=promitor-agent-resource-discovery | |
if [ "$CONTAINER_RESTART_COUNT" -gt 0 ]; then | |
echo "Previous container logs" | |
kubectl logs -l app.kubernetes.io/name=promitor-agent-resource-discovery --previous | |
fi | |
if: always() | |
- name: Show Pod Info | |
run: kubectl describe pod -l app.kubernetes.io/name=promitor-agent-resource-discovery | |
if: always() | |
- name: Verify Pod & Container Status is Running | |
run: | | |
POD_STATUS=$(kubectl get pod -l app.kubernetes.io/name=promitor-agent-resource-discovery -o=jsonpath='{.items[0].status.phase}') | |
echo "Pod status is ${POD_STATUS}." | |
CONTAINER_READY=$(kubectl get pod -l app.kubernetes.io/name=promitor-agent-resource-discovery -o=jsonpath='{.items[0].status.containerStatuses[0].ready}') | |
echo "Is the container ready: ${CONTAINER_READY}." | |
if [ "$POD_STATUS" = "Running" ]; then | |
if $CONTAINER_READY; then | |
exit 0 | |
else | |
exit -1 | |
fi | |
else | |
exit -1 | |
fi | |
if: always() | |