Skip to content

fix ci results comment #4490

fix ci results comment

fix ci results comment #4490

Workflow file for this run

name: K8s-CI
on:
pull_request:
branches:
- main
- "[0-9]+.[0-9]+"
types: [ opened, synchronize, reopened ]
push:
branches:
- main
- "[0-9]+.[0-9]+"
env:
CONTAINER_SUFFIX: ${{ github.run_id }}
CI_ELASTIC_AGENT_DOCKER_TAG: "8.14.0-SNAPSHOT"
CI_ELASTIC_AGENT_DOCKER_IMAGE: "704479110758.dkr.ecr.eu-west-2.amazonaws.com/elastic-agent"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
Build:
name: Build
runs-on: ubuntu-20.04
timeout-minutes: 40
steps:
# Disk cleanup
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: true
swap-storage: true
- name: Check out the repo
uses: actions/checkout@v4
- name: Setup GO (with caching)
uses: magnetikonline/action-golang-cache@v5
with:
go-version-file: .go-version
- name: build cloudbeat binary
uses: magefile/mage-action@v3
with:
version: latest
args: build
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Build dependencies
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.workflow }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build cloudbeat-docker
uses: docker/build-push-action@v5
with:
context: .
file: ./deploy/Dockerfile
push: false
tags: cloudbeat:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
outputs: type=docker,dest=/tmp/cloudbeat-${{ env.CONTAINER_SUFFIX }}.tar
- name: Build elastic-agent
env:
BASE_IMAGE: docker.elastic.co/beats/elastic-agent:${{ env.CI_ELASTIC_AGENT_DOCKER_TAG }}
GOOS: linux
GOARCH: amd64
run: ./scripts/packaging/docker/elastic-agent/build.sh -t ${{ env.CI_ELASTIC_AGENT_DOCKER_IMAGE }}:${{ env.CI_ELASTIC_AGENT_DOCKER_TAG }}
shell: bash
- name: Build pytest-docker
uses: docker/build-push-action@v5
with:
context: ./tests/.
push: false
tags: cloudbeat-test:latest
cache-from: type=local,mode=max,src=/tmp/.buildx-cache
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
outputs: type=docker,dest=/tmp/pytest-${{ env.CONTAINER_SUFFIX }}.tar
- name: Cache docker images
uses: actions/cache@v4
with:
path: /tmp/*.tar
key: ${{ runner.os }}-dockers-cache-${{ env.CONTAINER_SUFFIX }}
- name: Move cache
run: |
./.ci/scripts/gh-cache.sh
shell: bash
k8s_functional_tests:
# Run only selected tests on PRs
# if: github.event_name == 'pull_request'
if: ${{ false }}
name: ${{ matrix.test-target }}-${{ matrix.kind-config }}
needs: [ Build ]
runs-on: ubuntu-22.04
timeout-minutes: 55
strategy:
fail-fast: false
matrix:
include:
- test-target: pre_merge
range: ""
kind-config: kind-multi
- test-target: pre_merge_agent
range: ''
values_file: tests/test_environments/values/ci-sa-agent.yml
kind-config: kind-multi
- test-target: k8s_file_system_rules
range: ''
values_file: tests/test_environments/values/ci-test-k8s-files.yml
kind-config: kind-test-files
- test-target: k8s_object_psp_rules
range: ''
values_file: tests/test_environments/values/ci-test-k8s-objects.yml
kind-config: kind-multi
- test-target: k8s_process_rules
range: ''
values_file: tests/test_environments/values/ci-test-k8s-proc-conf1.yml
kind-config: kind-test-proc-conf1
- test-target: k8s_process_rules
range: ''
values_file: tests/test_environments/values/ci-test-k8s-proc-conf2.yml
kind-config: kind-test-proc-conf2
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: true
swap-storage: true
- name: Check out the repo
uses: actions/checkout@v4
- name: Init Hermit
run: ./bin/hermit env -r >> $GITHUB_ENV
- name: Prepare Kind Cluster for Process Tests
if: contains(matrix.kind-config, 'conf2')
run: |
# Workaround: Direct creation of a Kind cluster for config2 fails to start control-plane (kubelet fails)
# Creating and deleting a kind-mono cluster as a preparation for configuring Kind for process tests
just create-kind-cluster kind-mono
just delete-kind-cluster kind-mono
- name: Create k8s Kind Cluster
run: |
just create-kind-cluster ${{ matrix.kind-config }}
- name: Cache docker images
uses: actions/cache@v4
with:
path: /tmp/*.tar
key: ${{ runner.os }}-dockers-cache-${{ env.CONTAINER_SUFFIX }}
- name: Load images to kind
run: |
./.ci/scripts/kind-images.sh ${{ env.CONTAINER_SUFFIX }} ${{ matrix.kind-config }}
shell: bash
- name: Deploy tests Helm chart
id: deploy_helm
run: |
just deploy-tests-helm ${{ matrix.test-target }} ${{ matrix.values_file }} ${{ matrix.range }}
- name: Deploy K8s Objects
if: contains(matrix.test-target, 'object_psp')
run: |
just apply-k8s-test-objects
- name: Run Tests
id: run_tests
run: |
just run-tests ${{ matrix.test-target }} kind-${{ matrix.kind-config }}
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v3
with:
name: allure_results-${{ matrix.test-target}}
path: tests/allure/results/
- name: clear cache
id: clear_cache
if: always()
run: rm -rf /tmp/*-${{ env.CONTAINER_SUFFIX }}.tar