-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Complete migration from Cirrus CI to GHA (Lima) #5239
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
Merged
+111
−171
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| #!/bin/bash | ||
| # This script is used for initializing the host environment for CI. | ||
| # Supports Fedora and EL-based distributions. | ||
| set -eux -o pipefail | ||
|
|
||
| : "${LIBPATHRS_VERSION:=0.2.4}" | ||
|
|
||
| # BATS_VERSION is only consumed for the EL8 platform as its bats package is too old. | ||
| : "${BATS_VERSION:=v1.12.0}" | ||
|
|
||
| SCRIPTDIR="$(dirname "${BASH_SOURCE[0]}")" | ||
|
|
||
| # PLATFORM_ID is not available on Fedora | ||
| PLATFORM_ID= | ||
| grep -q ^PLATFORM_ID /etc/os-release && PLATFORM_ID="$(grep -oP '^PLATFORM_ID="\K[^"]+' /etc/os-release)" | ||
|
|
||
| # Initialize DNF | ||
| DNF=(dnf -y --setopt=install_weak_deps=False --setopt=tsflags=nodocs) | ||
| case "$PLATFORM_ID" in | ||
| platform:el8) | ||
| # DNF+=(--exclude="kernel,kernel-core") seems to fail | ||
| "${DNF[@]}" config-manager --set-enabled powertools # for glibc-static | ||
| "${DNF[@]}" install epel-release | ||
| ;; | ||
| platform:el9 | platform:el10) | ||
| DNF+=(--exclude="kernel,kernel-core") | ||
| "${DNF[@]}" config-manager --set-enabled crb # for glibc-static | ||
| "${DNF[@]}" install epel-release | ||
| ;; | ||
| *) | ||
| # Fedora | ||
| DNF+=(--exclude="kernel,kernel-core") | ||
| ;; | ||
| esac | ||
|
|
||
| # Install common packages | ||
| RPMS=(cargo container-selinux fuse-sshfs git-core glibc-static golang iptables jq libseccomp-devel lld make policycoreutils wget) | ||
| # Work around dnf mirror failures by retrying a few times. | ||
| for i in $(seq 0 2); do | ||
| sleep "$i" | ||
| "${DNF[@]}" update && "${DNF[@]}" install "${RPMS[@]}" && break | ||
| done | ||
| # shellcheck disable=SC2181 | ||
| [ $? -eq 0 ] # fail if dnf failed | ||
|
|
||
| # Install CRIU | ||
| if [ "$PLATFORM_ID" = "platform:el8" ]; then | ||
| # Use newer criu (with https://github.com/checkpoint-restore/criu/pull/2545). | ||
| # Alas we have to disable container-tools for that. | ||
| "${DNF[@]}" module disable container-tools | ||
| "${DNF[@]}" copr enable adrian/criu-el8 | ||
| fi | ||
| "${DNF[@]}" install criu | ||
|
|
||
| # Install BATS | ||
| if [ "$PLATFORM_ID" = "platform:el8" ]; then | ||
| # The packaged version of bats is too old: `BATS_ERROR_SUFFIX: unbound variable`, `bats_require_minimum_version: command not found` | ||
| ( | ||
| cd /tmp | ||
| git clone https://github.com/bats-core/bats-core | ||
| ( | ||
| cd bats-core | ||
| git checkout "$BATS_VERSION" | ||
| ./install.sh /usr/local | ||
| cat >>/etc/profile.d/sh.local <<'EOF' | ||
| PATH="/usr/local/bin:$PATH" | ||
| export PATH | ||
| EOF | ||
| cat >/etc/sudoers.d/local <<'EOF' | ||
| Defaults secure_path = "/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" | ||
| EOF | ||
| ) | ||
| rm -rf bats-core | ||
| ) | ||
| else | ||
| "${DNF[@]}" install bats | ||
| fi | ||
|
|
||
| # Clean up DNF | ||
| dnf clean all | ||
|
|
||
| # Install libpathrs | ||
| "$SCRIPTDIR"/build-libpathrs.sh "$LIBPATHRS_VERSION" /usr | ||
|
|
||
| # Setup rootless user. | ||
| "$SCRIPTDIR"/setup_rootless.sh | ||
|
|
||
| # Delegate all cgroup v2 controllers to rootless user via --systemd-cgroup | ||
|
AkihiroSuda marked this conversation as resolved.
|
||
| if [ -e /sys/fs/cgroup/cgroup.controllers ]; then | ||
| mkdir -p /etc/systemd/system/user@.service.d | ||
| cat >/etc/systemd/system/user@.service.d/delegate.conf <<'EOF' | ||
| [Service] | ||
| # The default (since systemd v252) is "pids memory cpu". | ||
| Delegate=yes | ||
| EOF | ||
| systemctl daemon-reload | ||
| fi | ||
|
|
||
| # Allow potentially unsafe tests. | ||
| echo 'export RUNC_ALLOW_UNSAFE_TESTS=yes' >>/root/.bashrc | ||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.