-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): changing main pipeline to run on self hosted runners (#400)
* changing main pipeline to run on self hosted runners * removing unneeded steps in main pipeline * fallback to standalone execution if remote fails * adding debug step for creating cache folder if it doesn't exist * adding shell * adding mkdir * adding git * adding update and upgrade if needed * adding -y to all apt commands * fixing setup * fixing setup * adding gcc * updating vector sha * adding platforms * adding docker components * adding gpg keys * adding manifest sha * removing docker * adding echos * adjusting workspace_status.sh * adding clang and g++ * adding libssl * adding pkg-config * printing openssl version * installing correct openssl * fixing dir creating * adding sleep to debug * adding symbolic links * installing full docker * removing groupadd * removing group management * adding systemd * adding sudo for docker info * removing dry-running of tarballs * testing configured custom image * setting container for the job * changing ci disk cache and repo cache locations * testing new runner setup * adding chown step * fixing indentation * cleaning up pipeline * commenting out currently unknown part * removing obsolete shell scripts * Revert "removing obsolete shell scripts" This reverts commit 98e6faa. * adding checks to execute some code only on github hosted runners * setting different container image for our ci * adding debug setp * changing uid * adding check for uid and gid * patching bash scripts
- Loading branch information
1 parent
dbd482b
commit 51fcd6b
Showing
8 changed files
with
85 additions
and
12 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,23 +12,51 @@ inputs: | |
runs: | ||
using: composite | ||
steps: | ||
- name: "👮♀️ Setup runner" | ||
if: ${{ startsWith(runner.name, 'dre-runner-custom') }} | ||
shell: bash | ||
run: | | ||
set -exuo pipefail | ||
whoami | ||
path_to_check="/home/runner/.cache" | ||
current_owner=$(stat -c "%u" "$path_to_check") | ||
current_group=$(stat -c "%g" "$path_to_check") | ||
desired_owner=1001 | ||
desired_group=1001 | ||
# Check if the current owner and group match the desired owner and group | ||
if [ "$current_owner" -ne "$desired_owner" ] || [ "$current_group" -ne "$desired_group" ]; then | ||
echo "Owner or group of cache does not match. Changing ownership..." | ||
# Change the owner and group recursively | ||
sudo chown -R $desired_owner:$desired_group "$path_to_check" | ||
echo "Ownership changed to $desired_owner:$desired_group for $path_to_check" | ||
else | ||
echo "Ownership is already set to $desired_owner:$desired_group for $path_to_check" | ||
fi | ||
######################################## | ||
# Setup | ||
######################################## | ||
- name: "🔧 Free Up Disk Space" | ||
uses: jlumbroso/[email protected] | ||
if: ${{ !startsWith(runner.name, 'dre-runner-custom') }} | ||
with: | ||
# this might remove tools that are actually needed, | ||
# when set to "true" but frees about 6 GB | ||
tool-cache: true | ||
large-packages: true # this is slow | ||
|
||
- uses: bazelbuild/setup-bazelisk@v2 | ||
|
||
######################################## | ||
# Download and unpack cache | ||
######################################## | ||
- name: "☁️ ⬇️ Restore bazel cache" | ||
uses: actions/cache/restore@v4 | ||
if: ${{ !startsWith(runner.name, 'dre-runner-custom') }} | ||
with: | ||
path: "~/.cache/bazel" | ||
# Configure cache updates | ||
|
@@ -37,14 +65,16 @@ runs: | |
key: ${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE.bazel', 'Cargo.Bazel.lock', 'requirements.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-bazel- | ||
- name: "🧹 Clean bazel cache if we're preparing a new release" | ||
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | ||
if: ${{ startsWith(github.ref, 'refs/tags/v') && !startsWith(runner.name, 'dre-runner-custom') }} | ||
# This is desirable to make sure bazel does not use stale pre-built binaries | ||
# Bazel actually keeps all intermediate objects so builds are still fast | ||
run: bazel clean | ||
shell: bash | ||
|
||
- name: "☁️ Setup S3 cache credentials" | ||
if: ${{ !startsWith(runner.name, 'dre-runner-custom') }} | ||
id: bazel-remote-creds | ||
shell: bash | ||
run: | | ||
|
@@ -55,13 +85,14 @@ runs: | |
[wasabi] | ||
region = eu-central-2 | ||
_EOF | ||
cat <<_EOF | install -m 0600 /dev/stdin ~/.aws/credentials | ||
[wasabi] | ||
aws_access_key_id = ${{ inputs.aws_access_key_id }} | ||
aws_secret_access_key = ${{ inputs.aws_secret_access_key }} | ||
_EOF | ||
- name: "💾 Start bazel-remote s3 cache" | ||
if: ${{ !startsWith(runner.name, 'dre-runner-custom') }} | ||
run: ./bin/bazel-cache-s3-start.sh | ||
shell: bash | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
FROM ubuntu:20.04 | ||
|
||
LABEL org.opencontainers.image.source="https://github.com/dfinity/dre" | ||
|
||
ENV TZ=UTC | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
ENV RUNNER_UID=1001 | ||
|
||
RUN apt-get update && \ | ||
apt-get upgrade -y && \ | ||
apt-get install ca-certificates curl git-all gcc g++ clang pkg-config make sudo docker.io build-essential -y | ||
|
||
RUN mkdir -p openssl && \ | ||
curl -o openssl/openssl-1.1.1w.tar.gz -L https://www.openssl.org/source/old/1.1.1/openssl-1.1.1w.tar.gz && \ | ||
tar -xzvf openssl/openssl-1.1.1w.tar.gz -C openssl && \ | ||
cd openssl/openssl-1.1.1w && \ | ||
./config && \ | ||
make && \ | ||
make install | ||
RUN ln -s /usr/local/lib/libssl.so.1.1 /usr/lib64/libssl.so.1.1 && \ | ||
ln -s /usr/local/lib/libssl.so.1.1 /usr/lib/libssl.so.1.1 && \ | ||
ln -s /usr/local/lib/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1 && \ | ||
ln -s /usr/local/lib/libcrypto.so.1.1 /usr/lib/libcrypto.so.1.1 && \ | ||
rm -rf openssl | ||
|
||
# Runner user | ||
RUN adduser --disabled-password --gecos "" --uid $RUNNER_UID runner \ | ||
&& usermod -aG sudo runner \ | ||
&& usermod -aG docker runner \ | ||
&& echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers \ | ||
&& echo "Defaults env_keep += \"DEBIAN_FRONTEND\"" >> /etc/sudoers | ||
ENV HOME=/home/runner | ||
USER runner | ||
WORKDIR /home/runner |