From d0835dc7aa2ea6885798170302ea33de57af9e15 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Thu, 5 Dec 2024 13:05:14 +0100 Subject: [PATCH 01/19] [experiment] test code build runner --- src/ci/github-actions/jobs.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index 2ea37c168dd3c..6bb7e2230d0fd 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -46,6 +46,10 @@ runners: - &job-aarch64-linux os: ubuntu-22.04-arm64-8core-32gb + - &job-linux-4c-codebuild + os: codebuild-ubuntu-24-4c-${{ github.run_id }}-${{ github.run_attempt }} + <<: *base-job + envs: env-x86_64-apple-tests: &env-x86_64-apple-tests SCRIPT: ./x.py --stage 2 test --skip tests/ui --skip tests/rustdoc -- --exact @@ -237,7 +241,7 @@ auto: <<: *job-linux-4c - image: x86_64-gnu - <<: *job-linux-4c + <<: *job-linux-4c-codebuild # This job ensures commits landing on nightly still pass the full # test suite on the stable channel. There are some UI tests that From efb9f7135f7f2fbd731c8de2e41944c9ad434b2f Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Thu, 5 Dec 2024 15:28:03 +0100 Subject: [PATCH 02/19] fix python script --- src/ci/github-actions/calculate-job-matrix.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/ci/github-actions/calculate-job-matrix.py b/src/ci/github-actions/calculate-job-matrix.py index 7de6d5fcd5f75..faa6da7243c01 100755 --- a/src/ci/github-actions/calculate-job-matrix.py +++ b/src/ci/github-actions/calculate-job-matrix.py @@ -176,6 +176,21 @@ def format_run_type(run_type: WorkflowRunType) -> str: raise AssertionError() +# Add new function before main: +def substitute_github_vars(jobs: list) -> list: + """Replace GitHub context variables with environment variables in job configs.""" + for job in jobs: + if "os" in job: + job["os"] = job["os"].replace( + "${{ github.run_id }}", + os.environ["GITHUB_RUN_ID"] + ).replace( + "${{ github.run_attempt }}", + os.environ["GITHUB_RUN_ATTEMPT"] + ) + return jobs + + if __name__ == "__main__": logging.basicConfig(level=logging.INFO) @@ -195,6 +210,7 @@ def format_run_type(run_type: WorkflowRunType) -> str: jobs = calculate_jobs(run_type, data) jobs = skip_jobs(jobs, channel) + if not jobs: raise Exception("Scheduled job list is empty, this is an error") From 9eaf00c848ccefd84e6a4853220e7fbe0a2fce5c Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Thu, 5 Dec 2024 15:39:20 +0100 Subject: [PATCH 03/19] fix python --- src/ci/github-actions/calculate-job-matrix.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ci/github-actions/calculate-job-matrix.py b/src/ci/github-actions/calculate-job-matrix.py index faa6da7243c01..969acd992dcc0 100755 --- a/src/ci/github-actions/calculate-job-matrix.py +++ b/src/ci/github-actions/calculate-job-matrix.py @@ -209,6 +209,7 @@ def substitute_github_vars(jobs: list) -> list: if run_type is not None: jobs = calculate_jobs(run_type, data) jobs = skip_jobs(jobs, channel) + jobs = substitute_github_vars(jobs) if not jobs: From ee92da1480dd3973a5c193e6dac4bb2e77dde439 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Thu, 5 Dec 2024 16:00:47 +0100 Subject: [PATCH 04/19] install docker --- .github/workflows/ci.yml | 3 +++ src/ci/scripts/ubuntu-codebuild.sh | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 src/ci/scripts/ubuntu-codebuild.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f6df348b72140..66aa0e5a6236d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -145,6 +145,9 @@ jobs: - name: install awscli run: src/ci/scripts/install-awscli.sh + - if: contains(matrix.os, 'codebuild-ubuntu') + run: src/ci/scripts/ubuntu-codebuild.sh + - name: install sccache run: src/ci/scripts/install-sccache.sh diff --git a/src/ci/scripts/ubuntu-codebuild.sh b/src/ci/scripts/ubuntu-codebuild.sh new file mode 100644 index 0000000000000..de5634886f023 --- /dev/null +++ b/src/ci/scripts/ubuntu-codebuild.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo apt install -y docker-buildx From 48f9d4f4999c3138f88a656f9842141ec016b3f5 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Thu, 5 Dec 2024 16:10:55 +0100 Subject: [PATCH 05/19] fix apt --- src/ci/scripts/ubuntu-codebuild.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ci/scripts/ubuntu-codebuild.sh b/src/ci/scripts/ubuntu-codebuild.sh index de5634886f023..fefb28a58f249 100644 --- a/src/ci/scripts/ubuntu-codebuild.sh +++ b/src/ci/scripts/ubuntu-codebuild.sh @@ -1,3 +1,4 @@ #!/bin/bash -sudo apt install -y docker-buildx +apt-get update +apt-get install -y docker-buildx From c1c40b5fab837746de3121d7bdad2786cf062e76 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Thu, 5 Dec 2024 16:25:51 +0100 Subject: [PATCH 06/19] fix apt --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 66aa0e5a6236d..e59eef89d86d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -146,7 +146,8 @@ jobs: run: src/ci/scripts/install-awscli.sh - if: contains(matrix.os, 'codebuild-ubuntu') - run: src/ci/scripts/ubuntu-codebuild.sh + name: Install sotftware for codebuild + run: chmod +x src/ci/scripts/ubuntu-codebuild.sh && ./src/ci/scripts/ubuntu-codebuild.sh - name: install sccache run: src/ci/scripts/install-sccache.sh From 7ade7c4c05eb7bf048fe69359838ee7e9bb5d3e7 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Thu, 5 Dec 2024 16:58:50 +0100 Subject: [PATCH 07/19] debug --- src/ci/scripts/enable-docker-ipv6.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ci/scripts/enable-docker-ipv6.sh b/src/ci/scripts/enable-docker-ipv6.sh index 03d5a75e24e27..257ffe374f90d 100755 --- a/src/ci/scripts/enable-docker-ipv6.sh +++ b/src/ci/scripts/enable-docker-ipv6.sh @@ -7,6 +7,9 @@ IFS=$'\n\t' source "$(cd "$(dirname "$0")" && pwd)/../shared.sh" +# Print docker version +docker --version + if isLinux; then sudo mkdir -p /etc/docker echo '{"ipv6":true,"fixed-cidr-v6":"fd9a:8454:6789:13f7::/64"}' \ From 05a77eed55688ebdb659270c71c17fd7d8860f59 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Thu, 5 Dec 2024 17:40:11 +0100 Subject: [PATCH 08/19] debug info --- src/ci/scripts/enable-docker-ipv6.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ci/scripts/enable-docker-ipv6.sh b/src/ci/scripts/enable-docker-ipv6.sh index 257ffe374f90d..fb09a399d9bec 100755 --- a/src/ci/scripts/enable-docker-ipv6.sh +++ b/src/ci/scripts/enable-docker-ipv6.sh @@ -9,6 +9,9 @@ source "$(cd "$(dirname "$0")" && pwd)/../shared.sh" # Print docker version docker --version +lsb_release -a +echo "is docker active" +systemctl is-active docker if isLinux; then sudo mkdir -p /etc/docker From f0fc184342cc4fd8a9b2e4a29595223365826107 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Thu, 5 Dec 2024 17:51:43 +0100 Subject: [PATCH 09/19] no ipv6 --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e59eef89d86d9..d78d492127ad8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -178,6 +178,8 @@ jobs: - name: enable ipv6 on Docker run: src/ci/scripts/enable-docker-ipv6.sh + # Don't run on codebuild because systemctl is not available + if: ${{ !contains(matrix.os, 'codebuild-ubuntu') }} # Disable automatic line ending conversion (again). On Windows, when we're # installing dependencies, something switches the git configuration directory or From b8188740ec208a7aebe0180adeb8ed0783f237e9 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Fri, 6 Dec 2024 16:15:22 +0100 Subject: [PATCH 10/19] update codebuild project --- src/ci/github-actions/jobs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index 6bb7e2230d0fd..7df149128b4e2 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -47,7 +47,7 @@ runners: os: ubuntu-22.04-arm64-8core-32gb - &job-linux-4c-codebuild - os: codebuild-ubuntu-24-4c-${{ github.run_id }}-${{ github.run_attempt }} + os: codebuild-ubuntu-22-4c-${{ github.run_id }}-${{ github.run_attempt }} <<: *base-job envs: From ba9a0c6aca6930339e6dc4f6d7c258d20df750e6 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Wed, 11 Dec 2024 12:16:39 +0100 Subject: [PATCH 11/19] update to 8 core --- src/ci/github-actions/jobs.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index 7df149128b4e2..10756dd4951cd 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -46,8 +46,8 @@ runners: - &job-aarch64-linux os: ubuntu-22.04-arm64-8core-32gb - - &job-linux-4c-codebuild - os: codebuild-ubuntu-22-4c-${{ github.run_id }}-${{ github.run_attempt }} + - &job-linux-8c-codebuild + os: codebuild-ubuntu-22-8c-${{ github.run_id }}-${{ github.run_attempt }} <<: *base-job envs: @@ -241,7 +241,7 @@ auto: <<: *job-linux-4c - image: x86_64-gnu - <<: *job-linux-4c-codebuild + <<: *job-linux-8c-codebuild # This job ensures commits landing on nightly still pass the full # test suite on the stable channel. There are some UI tests that From 3f1e15646f09849a68715e6e242380b83ece974d Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Wed, 11 Dec 2024 15:08:31 +0100 Subject: [PATCH 12/19] exclude problematic test --- tests/rustdoc-ui/issues/issue-98690.rs | 10 ---------- tests/rustdoc-ui/issues/issue-98690.stderr | 1 - 2 files changed, 11 deletions(-) delete mode 100644 tests/rustdoc-ui/issues/issue-98690.rs delete mode 100644 tests/rustdoc-ui/issues/issue-98690.stderr diff --git a/tests/rustdoc-ui/issues/issue-98690.rs b/tests/rustdoc-ui/issues/issue-98690.rs deleted file mode 100644 index 01708f3f64d3e..0000000000000 --- a/tests/rustdoc-ui/issues/issue-98690.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ compile-flags: --test --persist-doctests /../../ -Z unstable-options -//@ failure-status: 101 -//@ only-linux - -#![crate_name = "foo"] - -//! ```rust -//! use foo::dummy; -//! dummy(); -//! ``` diff --git a/tests/rustdoc-ui/issues/issue-98690.stderr b/tests/rustdoc-ui/issues/issue-98690.stderr deleted file mode 100644 index 47d94f99a4563..0000000000000 --- a/tests/rustdoc-ui/issues/issue-98690.stderr +++ /dev/null @@ -1 +0,0 @@ -Couldn't create directory for doctest executables: Permission denied (os error 13) From b009d5c2b0fbe77056ac68cabefe307191a5bfa7 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Thu, 12 Dec 2024 15:33:18 +0100 Subject: [PATCH 13/19] add buildspec for troubleshooting --- buildspec.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 buildspec.yml diff --git a/buildspec.yml b/buildspec.yml new file mode 100644 index 0000000000000..d541f8430f262 --- /dev/null +++ b/buildspec.yml @@ -0,0 +1,11 @@ +version: 0.2 + +phases: + build: + commands: + - echo "Starting sleep for troubleshooting..." + - sleep 3600 # Sleeps for 1 hour + + post_build: + commands: + - echo "Build completed" From c3ed253040b4ea2dcb78cd1c1b9ea87eda2ba7d8 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:49:25 +0100 Subject: [PATCH 14/19] don't run container as root --- src/ci/docker/run.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh index d554186df4cfe..710f014db7d4a 100755 --- a/src/ci/docker/run.sh +++ b/src/ci/docker/run.sh @@ -282,8 +282,12 @@ else # LOCAL_USER_ID will map to a different subuid range on the host. # The "keep-id" mode maps the current UID directly into the container. args="$args --env NO_CHANGE_USER=1 --userns=keep-id" - else + else if [[ "$id" != 0 ]]; then args="$args --env LOCAL_USER_ID=$id" + else + # If we're running as root, we don't want to run the container as root, + # so we set id `1001` instead of `0`. + args="$args --env LOCAL_USER_ID=1001" fi fi From 3c704790b562e03b923253a00593c0c880e408a0 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:50:06 +0100 Subject: [PATCH 15/19] Revert "add buildspec for troubleshooting" This reverts commit b009d5c2b0fbe77056ac68cabefe307191a5bfa7. --- buildspec.yml | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 buildspec.yml diff --git a/buildspec.yml b/buildspec.yml deleted file mode 100644 index d541f8430f262..0000000000000 --- a/buildspec.yml +++ /dev/null @@ -1,11 +0,0 @@ -version: 0.2 - -phases: - build: - commands: - - echo "Starting sleep for troubleshooting..." - - sleep 3600 # Sleeps for 1 hour - - post_build: - commands: - - echo "Build completed" From 6aab2241957d7e8375e8c0e756590cb8625b5455 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:50:20 +0100 Subject: [PATCH 16/19] Revert "exclude problematic test" This reverts commit 3f1e15646f09849a68715e6e242380b83ece974d. --- tests/rustdoc-ui/issues/issue-98690.rs | 10 ++++++++++ tests/rustdoc-ui/issues/issue-98690.stderr | 1 + 2 files changed, 11 insertions(+) create mode 100644 tests/rustdoc-ui/issues/issue-98690.rs create mode 100644 tests/rustdoc-ui/issues/issue-98690.stderr diff --git a/tests/rustdoc-ui/issues/issue-98690.rs b/tests/rustdoc-ui/issues/issue-98690.rs new file mode 100644 index 0000000000000..01708f3f64d3e --- /dev/null +++ b/tests/rustdoc-ui/issues/issue-98690.rs @@ -0,0 +1,10 @@ +//@ compile-flags: --test --persist-doctests /../../ -Z unstable-options +//@ failure-status: 101 +//@ only-linux + +#![crate_name = "foo"] + +//! ```rust +//! use foo::dummy; +//! dummy(); +//! ``` diff --git a/tests/rustdoc-ui/issues/issue-98690.stderr b/tests/rustdoc-ui/issues/issue-98690.stderr new file mode 100644 index 0000000000000..47d94f99a4563 --- /dev/null +++ b/tests/rustdoc-ui/issues/issue-98690.stderr @@ -0,0 +1 @@ +Couldn't create directory for doctest executables: Permission denied (os error 13) From 8bdc25e174be896eedaa9c4af060a9b6fa6d8f05 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:51:07 +0100 Subject: [PATCH 17/19] don't install docker --- src/ci/scripts/ubuntu-codebuild.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ci/scripts/ubuntu-codebuild.sh b/src/ci/scripts/ubuntu-codebuild.sh index fefb28a58f249..da5371965de46 100644 --- a/src/ci/scripts/ubuntu-codebuild.sh +++ b/src/ci/scripts/ubuntu-codebuild.sh @@ -1,4 +1,4 @@ #!/bin/bash -apt-get update -apt-get install -y docker-buildx +# apt-get update +# apt-get install -y docker-buildx From a59528536c8ed3ab6c1efd69d4d178cfbabd2cd3 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:58:24 +0100 Subject: [PATCH 18/19] fix syntax --- src/ci/docker/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh index 710f014db7d4a..82f17f82261b8 100755 --- a/src/ci/docker/run.sh +++ b/src/ci/docker/run.sh @@ -282,7 +282,7 @@ else # LOCAL_USER_ID will map to a different subuid range on the host. # The "keep-id" mode maps the current UID directly into the container. args="$args --env NO_CHANGE_USER=1 --userns=keep-id" - else if [[ "$id" != 0 ]]; then + elif [[ "$id" != 0 ]]; then args="$args --env LOCAL_USER_ID=$id" else # If we're running as root, we don't want to run the container as root, From 2550cc35f0013905de76d60b5ac4aa3c312ea663 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Fri, 13 Dec 2024 11:53:17 +0100 Subject: [PATCH 19/19] debug --- src/ci/scripts/run-build-from-ci.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ci/scripts/run-build-from-ci.sh b/src/ci/scripts/run-build-from-ci.sh index 55e75800d91c4..90d6894c7c234 100755 --- a/src/ci/scripts/run-build-from-ci.sh +++ b/src/ci/scripts/run-build-from-ci.sh @@ -17,7 +17,9 @@ echo "::add-matcher::src/ci/github-actions/problem_matchers.json" # the environment rustup self uninstall -y || true if [ -z "${IMAGE+x}" ]; then + echo "Running ci/run.sh" src/ci/run.sh else + echo "Running docker/run.sh with image ${IMAGE}" src/ci/docker/run.sh "${IMAGE}" fi