Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ppc64le core-bpf testing and PR testing #1448

Merged
merged 63 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
c0c3ba0
Use vanilla Falco
erthalion Oct 31, 2023
374caac
Cleanups + use falco 0.13.1
Molter73 Oct 3, 2023
b1025af
Cleanups + use falco 0.13.1
Molter73 Oct 3, 2023
389b3e1
Lets try this again, shall we?
Stringy Oct 20, 2023
57c15e8
Rename multiarch-integration-tests to s390x-integration-tests, for si…
Stringy Oct 30, 2023
8b6567b
Inherit secrets in s390x tests
Stringy Oct 30, 2023
8d5022f
Pin arch in collector tests image build
Stringy Nov 1, 2023
061c960
Add ppc64le testing and reenable core-bpf
Stringy Nov 29, 2023
bb44aa3
Possible fix to zero-size full images
Stringy Nov 29, 2023
b07e589
Check for zero size layer file
Stringy Nov 29, 2023
2cc5c2e
Dont forget the semicolon
Stringy Nov 29, 2023
6ddc1f7
Use wildcard to avoid missing directory errors
Stringy Nov 29, 2023
8b64483
Make layer directories, even if the layer is empty
Stringy Nov 29, 2023
0259abc
Only pull all images on amd64 (temporary?)
Stringy Nov 30, 2023
829a978
Forces zero-length bucket when no drivers exist
Stringy Dec 4, 2023
af11518
Fix some mistakenly commited changes
Stringy Dec 4, 2023
86b3670
Default to empty collector tag
Stringy Dec 6, 2023
d441b5b
Temporarily set default builder tag
Stringy Dec 6, 2023
35e503f
Fixes for ppc64le core-bpf testing
Stringy Dec 6, 2023
a3b1afa
disable full builds for s390x and power, forcing core-bpf testing
Stringy Dec 6, 2023
ac25909
Ansible provisioning and test changes for ppc64le; specifically bumpi…
Stringy Dec 7, 2023
bed285b
What an embarassing typo
Stringy Dec 7, 2023
8e2594a
Enable modern bpf everywhere
Stringy Dec 11, 2023
98ba030
Add TRACE_SINSP_EVENT for PR builds
Stringy Dec 12, 2023
d9aac63
Save cmake cache for build debugging
Stringy Dec 13, 2023
c8131b0
Bump qemu and buildx versions
Stringy Dec 13, 2023
b05e842
Initial attempt at native s390x builds
Stringy Dec 18, 2023
ad2096f
Move create-vms workflow to top level
Stringy Dec 18, 2023
113b2cb
Inherit secrets for vm creation
Stringy Dec 18, 2023
55971b0
Fix ssh key file usage in ansible
Stringy Dec 18, 2023
60d382a
Hardcode ssh paths (temp)
Stringy Dec 18, 2023
5d7da31
I dont want to talk about it
Stringy Dec 18, 2023
b7ac88b
Auth with GCP
Stringy Dec 18, 2023
ec104e6
Fix inventory downloading
Stringy Dec 18, 2023
fdf4225
Fix ansible config for host key checking
Stringy Dec 18, 2023
2eb6aa1
Adds ibm collection to ansible requirements
Stringy Dec 18, 2023
47381d2
Fix GCP ssh key file
Stringy Dec 18, 2023
4e981e6
Use VM_TYPE for build VMs
Stringy Dec 18, 2023
99b9913
Add git and make to redhat provisioning
Stringy Dec 18, 2023
33020f0
Fixes for VM destruction and git refs
Stringy Dec 18, 2023
5aca66c
Adds refspec for git clone
Stringy Dec 18, 2023
ccbdfc6
Env fixes for VM destruction
Stringy Dec 18, 2023
abff0bb
Fix git ref in builder build
Stringy Dec 18, 2023
5bb5308
Remove version from git clone
Stringy Dec 18, 2023
25dc68b
Remaining fixes for slim builds
Stringy Dec 18, 2023
55bd76a
Bump ibm disk size for CI
Stringy Dec 18, 2023
86b4032
Temp drop ppc64le and arm builders
Stringy Dec 18, 2023
90eedf1
typo
Stringy Dec 18, 2023
b29ddfe
Fixes rhacs_eng_image use in ansible build
Stringy Dec 18, 2023
9cc4289
clean up and fixes for test vms and power
Stringy Dec 19, 2023
c406b5a
Couple of fixes for python deps and inventory naming scheme
Stringy Dec 19, 2023
4618253
Consolidates ansible vars and fixes remote checkout
Stringy Dec 19, 2023
050b8eb
Fix build hosts
Stringy Dec 19, 2023
2bff037
Remove refs/ prefix from git ref
Stringy Dec 19, 2023
6f685f1
Fix GCP ssh key file
Stringy Dec 19, 2023
c2b1421
Reenable other archs and some cleanup
Stringy Dec 19, 2023
2631830
Moves vm creation into workflows to allow re-running of failed steps
Stringy Dec 20, 2023
c81c566
Fix ibm_env default
Stringy Dec 20, 2023
85a34c4
Fix amd64 vm creation
Stringy Dec 20, 2023
26ab212
Fix GCP ssh key file by using a new GCP specific group
Stringy Jan 2, 2024
44f93f2
Remove CMake Cache upload
Stringy Jan 2, 2024
b8b1b67
Fix ppc64le destruction (api key mismatch)
Stringy Jan 2, 2024
dc521ae
Fix region and zone in ppc64le destroy
Stringy Jan 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions .github/actions/setup-vm-creds/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Setup VM Credentials
description: |
This action will setup the runner with the necessary credentials to create and
interact with VMs

inputs:
gcp-ssh-key:
description:
The SSH private key to use for GCP
gcp-ssh-key-pub:
description:
The SSH public key to use for GCP
s390x-ssh-key:
description:
The SSH private key to use for s390x
ppc64le-ssh-key:
description:
The SSH private key to use for ppc64le
ppc64le-ssh-key-pub:
description:
The SSH public key to use for ppc64le
s390x-key:
description:
The API key to use for s390x
ppc64le-key:
description:
The API key to use for ppc64le
redhat-username:
description:
The username for registering redhat servers
redhat-password:
description:
The password for registering redhat servers
vm-type:
description:
The type of VMs to be created
job-tag:
description:
Optional job tag to add to the ID
runs:
using: composite
steps:
- shell: bash
run: |
mkdir -p /tmp/secret/stackrox-collector-e2e-tests
cp "$GOOGLE_APPLICATION_CREDENTIALS" /tmp/secret/stackrox-collector-e2e-tests/GOOGLE_CREDENTIALS_COLLECTOR_SVC_ACCT

mkdir -p "$HOME/.ssh"
chmod 0700 "$HOME/.ssh"

function copy_secret_to_file() {
local secret="$1"
local destination="$2"
local perms="$3"

echo "$secret" > "$destination"
chmod "$perms" "$destination"
}

copy_secret_to_file "${{ inputs.gcp-ssh-key }}" "$HOME/.ssh/google_compute_engine" 0600
copy_secret_to_file "${{ inputs.gcp-ssh-key-pub }}" "$HOME/.ssh/google_compute_engine.pub" 0600
copy_secret_to_file "${{ inputs.s390x-ssh-key }}" "$HOME/.ssh/acs-s390x-rsa.prv" 0600
copy_secret_to_file "${{ inputs.ppc64le-ssh-key }}" "$HOME/.ssh/acs-ppc64le-rsa.prv" 0600

ls -lah $HOME/.ssh/

- shell: bash
run: |
#
# JOB_ID is a little odd in that it needs to be unique per vm_type,
# but GHA's run_id is only unique per job. Appending the vm_type
# makes it fit our requirements...
#
# but wait, there's more
#
# the job id is used both as part of a GCP instance name and label, but
# also as a group name in ansible, which means it has some restrictions:
#
# - must be alpha-numeric
# - must not contain underscores (because of GCP)
# - must not contain hyphens (because of ansible)
#
# vm_type may contain hyphens, so the id is normalized below
#
JOB_ID="${{ github.run_id }}${{ inputs.vm-type }}${{ inputs.job-tag }}"
NORM_JOB_ID="${JOB_ID//-/}"

{
echo "IBM_CLOUD_POWER_API_KEY=${{ inputs.ppc64le-key }}"
echo "IBM_CLOUD_S390X_API_KEY=${{ inputs.s390x-key }}"
echo "IBM_CLOUD_POWER_SSH_PUBLIC_KEY=${{ inputs.ppc64le-ssh-key-pub }}"
echo "JOB_ID=${NORM_JOB_ID}"
echo "BUILD_TYPE=ci"
echo "VM_TYPE=${{ inputs.vm-type }}"
echo "REDHAT_USERNAME=${{ inputs.redhat-username }}"
echo "REDHAT_PASSWORD=${{ inputs.redhat-password }}"
} >> "$GITHUB_ENV"

- shell: bash
run: |
python -m pip install -r "${{ github.workspace }}/ansible/requirements.txt"
ansible-galaxy collection install -r "${{ github.workspace }}/ansible/requirements.yml"
ansible-galaxy collection install -r "${{ github.workspace }}/ansible/ansible-collections.yml"

# Added workaround for ssh connection issue with power vm from ubuntu machine.
# Changing mtu works in resolving the issue
- shell: bash
run: sudo ifconfig eth0 mtu 1000 up

63 changes: 55 additions & 8 deletions .github/workflows/collector-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ on:
outputs:
collector-builder-tag:
description: The builder tag used by the build
value: ${{ jobs.build-builder-image.outputs.collector-builder-tag || 'master' }}
value: ${{ jobs.build-builder-image.outputs.collector-builder-tag || '3.16.x-195-g8f32e71fad' }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was this image exactly? And would it be dropped before merging?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was taken from mauro's original vanilla PR and will be dropped before merging.


env:
COLLECTOR_TAG: ${{ inputs.collector-tag }}
DEFAULT_BUILDER_TAG: 3.16.x-195-g8f32e71fad
ANSIBLE_CONFIG: ${{ github.workspace }}/ansible/ansible.cfg

jobs:
builder-needs-rebuilding:
Expand Down Expand Up @@ -59,6 +60,7 @@ jobs:

env:
PLATFORM: linux/${{ matrix.arch }}
BUILD_TYPE: ci

steps:
- uses: actions/checkout@v3
Expand All @@ -71,6 +73,35 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- uses: actions/setup-python@v3
with:
python-version: "3.10"

- uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS_COLLECTOR_SVC_ACCT }}'

- uses: 'google-github-actions/setup-gcloud@v1'

- uses: ./.github/actions/setup-vm-creds
with:
gcp-ssh-key: ${{ secrets.GCP_SSH_KEY }}
gcp-ssh-key-pub: ${{ secrets.GCP_SSH_KEY_PUB }}
s390x-ssh-key: ${{ secrets.IBM_CLOUD_S390X_SSH_PRIVATE_KEY }}
ppc64le-ssh-key: ${{ secrets.IBM_CLOUD_POWER_SSH_PRIVATE_KEY }}
ppc64le-ssh-key-pub: ${{ secrets.IBM_CLOUD_POWER_SSH_PUBLIC_KEY }}
s390x-key: ${{ secrets.IBM_CLOUD_S390x_API_KEY }}
ppc64le-key: ${{ secrets.IBM_CLOUD_POWER_API_KEY }}
redhat-username: ${{ secrets.REDHAT_USERNAME }}
redhat-password: ${{ secrets.REDHAT_PASSWORD }}
vm-type: all
job-tag: builder

- name: Create Build VMs
if: matrix.arch == 's390x'
run: |
make -C "${{ github.workspace }}/ansible" create-build-vms

- name: Define builder tag
id: builder-tag
run: |
Expand All @@ -84,29 +115,27 @@ jobs:
echo "COLLECTOR_BUILDER_TAG=${COLLECTOR_BUILDER_TAG}" >> "$GITHUB_ENV"
echo "collector-builder-tag=${COLLECTOR_BUILDER_TAG}" >> "$GITHUB_OUTPUT"

- name: Create Ansible Vars (inc. secrets)
- name: Create ansible vars
run: |
{
echo "---"
echo "stackrox_io_username: ${{ secrets.QUAY_STACKROX_IO_RW_USERNAME }}"
echo "stackrox_io_password: ${{ secrets.QUAY_STACKROX_IO_RW_PASSWORD }}"
echo "rhacs_eng_username: ${{ secrets.QUAY_RHACS_ENG_RW_USERNAME }}"
echo "rhacs_eng_password: ${{ secrets.QUAY_RHACS_ENG_RW_PASSWORD }}"
echo "collector_git_ref: ${{ github.ref }}"
echo "collector_git_sha: ${{ github.sha }}"
echo "collector_builder_tag: ${{ env.COLLECTOR_BUILDER_TAG }}"
} > ${{ github.workspace }}/ansible/secrets.yml

if [[ "${RUNNER_DEBUG}" == "1" ]]; then
echo "ANSIBLE_STDOUT_CALLBACK=debug" >> "${GITHUB_ENV}"
fi

- name: Build images
if: |
github.event_name == 'push' ||
matrix.arch == 'amd64' ||
contains(github.event.pull_request.labels.*.name, 'run-multiarch-builds')
(contains(github.event.pull_request.labels.*.name, 'run-multiarch-builds') && matrix.arch != 's390x')
timeout-minutes: 480
run: |
ansible-galaxy install -r ansible/requirements.yml

ansible-playbook \
--connection local \
-i localhost, \
Expand All @@ -115,6 +144,24 @@ jobs:
-e @'${{ github.workspace }}/ansible/secrets.yml' \
ansible/ci-build-builder.yml

- name: Build s390x images
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels a bit weird, is it easier to build s390x images in a separate step, not as part of the previous one?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, yeah it's a little simpler, just because we can force the previous step to use localhost only, but this step will use the entire inventory (which is only one VM at the moment)

When I implement full multi-arch native builds I'll hopefully combine these steps

if: |
github.event_name == 'push' ||
(contains(github.event.pull_request.labels.*.name, 'run-multiarch-builds') && matrix.arch == 's390x')
timeout-minutes: 480
run: |
ansible-playbook \
-i ansible/ci \
-e build_hosts='job_id_${{ env.JOB_ID }}' \
-e arch='${{ matrix.arch }}' \
-e @'${{ github.workspace }}/ansible/secrets.yml' \
ansible/ci-build-builder.yml

- name: Destroy VMs
if: always() && matrix.arch == 's390x'
run: |
make -C ansible destroy-vms

create-multiarch-manifest:
needs:
- build-builder-image
Expand Down
79 changes: 68 additions & 11 deletions .github/workflows/collector-slim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ env:
COLLECTOR_TAG: ${{ inputs.collector-tag }}
COLLECTOR_BUILDER_TAG: ${{ inputs.collector-builder-tag }}
RHACS_ENG_IMAGE: quay.io/rhacs-eng/collector:${{ inputs.collector-tag }}
ANSIBLE_CONFIG: ${{ github.workspace }}/ansible/ansible.cfg

jobs:
build-collector-image:
Expand All @@ -42,54 +43,110 @@ jobs:
submodules: true

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- uses: actions/setup-python@v3
with:
python-version: "3.10"

- uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS_COLLECTOR_SVC_ACCT }}'

- uses: 'google-github-actions/setup-gcloud@v1'

- uses: ./.github/actions/setup-vm-creds
with:
gcp-ssh-key: ${{ secrets.GCP_SSH_KEY }}
gcp-ssh-key-pub: ${{ secrets.GCP_SSH_KEY_PUB }}
s390x-ssh-key: ${{ secrets.IBM_CLOUD_S390X_SSH_PRIVATE_KEY }}
ppc64le-ssh-key: ${{ secrets.IBM_CLOUD_POWER_SSH_PRIVATE_KEY }}
ppc64le-ssh-key-pub: ${{ secrets.IBM_CLOUD_POWER_SSH_PUBLIC_KEY }}
s390x-key: ${{ secrets.IBM_CLOUD_S390x_API_KEY }}
ppc64le-key: ${{ secrets.IBM_CLOUD_POWER_API_KEY }}
redhat-username: ${{ secrets.REDHAT_USERNAME }}
redhat-password: ${{ secrets.REDHAT_PASSWORD }}
vm-type: all
job-tag: builder

- name: Create Build VMs
if: matrix.arch == 's390x'
run: |
make -C "${{ github.workspace }}/ansible" create-build-vms

- name: Checks PR, main and release branches
run: |
if [[ "${{ github.event_name }}" == 'pull_request' ]]; then
echo "COLLECTOR_APPEND_CID=true" >> "$GITHUB_ENV"
echo "TRACE_SINSP_EVENTS=1" >> "$GITHUB_ENV"

if [[ "${{ contains(github.event.pull_request.labels.*.name, 'address-sanitizer') }}" == "true" ]]; then
echo "ADDRESS_SANITIZER=true" >> "$GITHUB_ENV"
fi
fi

- name: Create Ansible Vars (inc. secrets)
- name: Create ansible vars
run: |
{
echo "---"
echo "stackrox_io_username: ${{ secrets.QUAY_STACKROX_IO_RW_USERNAME }}"
echo "stackrox_io_password: ${{ secrets.QUAY_STACKROX_IO_RW_PASSWORD }}"
echo "rhacs_eng_username: ${{ secrets.QUAY_RHACS_ENG_RW_USERNAME }}"
echo "rhacs_eng_password: ${{ secrets.QUAY_RHACS_ENG_RW_PASSWORD }}"
echo "collector_git_ref: ${{ github.ref }}"
echo "collector_git_sha: ${{ github.sha }}"
echo "collector_builder_tag: ${{ env.COLLECTOR_BUILDER_TAG }}"
echo "disable_profiling: ${{ matrix.arch != 'amd64' && matrix.arch != 'arm64' }}"
echo "rhacs_eng_image: ${{ env.RHACS_ENG_IMAGE }}"
echo "collector_image: ${{ inputs.collector-image }}"
echo "collector_tag: ${{ inputs.collector-tag }}"
} > ${{ github.workspace }}/ansible/secrets.yml

if [[ "${RUNNER_DEBUG}" == "1" ]]; then
echo "ANSIBLE_STDOUT_CALLBACK=debug" >> "${GITHUB_ENV}"
fi
- name: Authenticate with GCP
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS_COLLECTOR_SVC_ACCT }}'

- name: Setup GCP
uses: 'google-github-actions/setup-gcloud@v1'

- name: Build images
if: |
github.event_name == 'push' ||
matrix.arch == 'amd64' ||
contains(github.event.pull_request.labels.*.name, 'run-multiarch-builds')
(contains(github.event.pull_request.labels.*.name, 'run-multiarch-builds') && matrix.arch != 's390x')
timeout-minutes: 480
run: |
ansible-galaxy install -r ansible/requirements.yml
ansible-playbook \
--connection local \
-i localhost, \
--limit localhost \
-e collector_image='${{ inputs.collector-image }}' \
-e arch='${{ matrix.arch }}' \
-e disable_profiling="${{ matrix.arch != 'amd64' && matrix.arch != 'arm64' }}" \
-e @'${{ github.workspace }}/ansible/secrets.yml' \
ansible/ci-build-collector.yml

- name: Build s390x image
if: |
github.event_name == 'push' ||
(contains(github.event.pull_request.labels.*.name, 'run-multiarch-builds') && matrix.arch == 's390x')
timeout-minutes: 480
run: |
ansible-playbook \
-i ansible/ci \
-e arch='${{ matrix.arch }}' \
-e build_hosts='job_id_${{ env.JOB_ID }}' \
-e @'${{ github.workspace }}/ansible/secrets.yml' \
ansible/ci-build-collector.yml
env:
ANSIBLE_CONFIG: ansible/ansible.cfg
VM_TYPE: rhel-s390x

- name: Destroy Build VMs
if: always() && matrix.arch == 's390x'
run: |
make -C ansible destroy-vms

create-multiarch-manifest:
needs:
Expand Down
Loading
Loading