From 7cd93b0a75ce45b15940499551dc6f5d96c7e8bd Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Sun, 22 Nov 2026 14:10:35 -0500 Subject: [PATCH] Drop references to codebuild We no longer use AWS CodeBuild for our jobs, so delete or rephrase code that referred to it. --- .github/workflows/ci.yml | 11 ---- .github/workflows/ghcr.yml | 2 +- src/ci/citool/src/jobs.rs | 11 +--- src/ci/citool/src/jobs/tests.rs | 67 ------------------------- src/ci/scripts/free-disk-space-linux.sh | 2 +- 5 files changed, 4 insertions(+), 89 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ad4bba147184..cb8d5974af09f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,17 +103,6 @@ jobs: # Check the `calculate_matrix` job to see how is the matrix defined. include: ${{ fromJSON(needs.calculate_matrix.outputs.jobs) }} steps: - - name: Install cargo in AWS CodeBuild - if: matrix.codebuild - run: | - # Check if cargo is installed - if ! command -v cargo &> /dev/null; then - echo "Cargo not found, installing Rust..." - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal - # Make cargo available in PATH - echo "$HOME/.cargo/bin" >> $GITHUB_PATH - fi - - name: disable git crlf conversion run: git config --global core.autocrlf false diff --git a/.github/workflows/ghcr.yml b/.github/workflows/ghcr.yml index f0f0ece750b9f..a1ac3306f3aaf 100644 --- a/.github/workflows/ghcr.yml +++ b/.github/workflows/ghcr.yml @@ -6,7 +6,7 @@ # Those images are pushed to ghcr.io by this job. # # While Docker Hub rate limit *shouldn't* be an issue on GitHub Actions, -# it certainly is for AWS codebuild. +# it may be for external self-hosted runners (e.g., EC2 runners). # # Note that authenticating to DockerHub or other registries isn't possible # for PR jobs, because forks can't access secrets. diff --git a/src/ci/citool/src/jobs.rs b/src/ci/citool/src/jobs.rs index b94f12a37cc77..6ca6cd10815ba 100644 --- a/src/ci/citool/src/jobs.rs +++ b/src/ci/citool/src/jobs.rs @@ -29,8 +29,6 @@ pub struct Job { pub free_disk: Option, /// Documentation link to a resource that could help people debug this CI job. pub doc_url: Option, - /// Whether the job is executed on AWS CodeBuild. - pub codebuild: Option, /// Which Python version (if any) is required. On Windows, this is typically required to run /// LLDB. #[serde(default)] @@ -170,7 +168,6 @@ fn validate_job_database(db: &JobDatabase) -> anyhow::Result<()> { only_on_channel, free_disk, doc_url, - codebuild, required_python_version, // Carve-out configs allowed to be different. @@ -183,7 +180,6 @@ fn validate_job_database(db: &JobDatabase) -> anyhow::Result<()> { && *only_on_channel == auto_job.only_on_channel && *free_disk == auto_job.free_disk && *doc_url == auto_job.doc_url - && *codebuild == auto_job.codebuild && *required_python_version == auto_job.required_python_version { Ok(()) @@ -249,14 +245,12 @@ struct GithubActionsJob { #[serde(skip_serializing_if = "Option::is_none")] doc_url: Option, #[serde(skip_serializing_if = "Option::is_none")] - codebuild: Option, - #[serde(skip_serializing_if = "Option::is_none")] required_python_version: Option, } /// Replace GitHub context variables with environment variables in job configs. -/// Used for codebuild jobs like -/// `codebuild-ubuntu-22-8c-$github.run_id-$github.run_attempt` +/// +/// This is used for self-hosted runner jobs to loosely tie an instance to a particular GHA job. fn substitute_github_vars(jobs: Vec) -> anyhow::Result> { let run_id = load_env_var("GITHUB_RUN_ID")?; let run_attempt = load_env_var("GITHUB_RUN_ATTEMPT")?; @@ -382,7 +376,6 @@ fn calculate_jobs( continue_on_error: job.continue_on_error, free_disk: job.free_disk, doc_url: job.doc_url, - codebuild: job.codebuild, required_python_version: job.required_python_version, } }) diff --git a/src/ci/citool/src/jobs/tests.rs b/src/ci/citool/src/jobs/tests.rs index 65990d35d61b1..0179157d85c58 100644 --- a/src/ci/citool/src/jobs/tests.rs +++ b/src/ci/citool/src/jobs/tests.rs @@ -81,73 +81,6 @@ fn check_pattern(db: &JobDatabase, pattern: &str, expected: &[&str]) { assert_eq!(jobs, expected); } -/// Validate that CodeBuild jobs use Docker images from ghcr.io registry. -/// This is needed because otherwise from CodeBuild we get rate limited by Docker Hub. -fn validate_codebuild_image(job: &Job) -> anyhow::Result<()> { - let is_job_on_codebuild = job.codebuild.unwrap_or(false); - if !is_job_on_codebuild { - // Jobs in GitHub Actions don't get rate limited by Docker Hub. - return Ok(()); - } - - let image_name = job.image(); - // we hardcode host-x86_64 here, because in codebuild we only run jobs for this architecture. - let dockerfile_path = - Path::new(DOCKER_DIRECTORY).join("host-x86_64").join(&image_name).join("Dockerfile"); - - if !dockerfile_path.exists() { - return Err(anyhow::anyhow!( - "Dockerfile not found for CodeBuild job '{}' at path: {}", - job.name, - dockerfile_path.display() - )); - } - - let dockerfile_content = utils::read_to_string(&dockerfile_path)?; - - // Check if all FROM statement uses ghcr.io registry - let has_ghcr_from = dockerfile_content - .lines() - .filter(|line| line.trim_start().to_lowercase().starts_with("from ")) - .all(|line| line.contains("ghcr.io")); - - if !has_ghcr_from { - return Err(anyhow::anyhow!( - "CodeBuild job '{}' must use ghcr.io registry in its Dockerfile FROM statement. \ - Dockerfile path: {dockerfile_path:?}", - job.name, - )); - } - - Ok(()) -} - -#[test] -fn validate_jobs() { - let db = { - let default_jobs_file = Path::new(JOBS_YML_PATH); - let db_str = utils::read_to_string(default_jobs_file).unwrap(); - load_job_db(&db_str).expect("Failed to load job database") - }; - - let all_jobs = db - .pr_jobs - .iter() - .chain(db.try_jobs.iter()) - .chain(db.auto_jobs.iter()) - .chain(db.optional_jobs.iter()) - .collect::>(); - - let errors: Vec = - all_jobs.into_iter().filter_map(|job| validate_codebuild_image(job).err()).collect(); - - if !errors.is_empty() { - let error_messages = - errors.into_iter().map(|e| format!("- {e}")).collect::>().join("\n"); - panic!("Job validation failed:\n{error_messages}"); - } -} - #[test] fn pr_job_implies_auto_job() { let db = load_job_db( diff --git a/src/ci/scripts/free-disk-space-linux.sh b/src/ci/scripts/free-disk-space-linux.sh index 1498bc0a24f2c..36c9505327157 100755 --- a/src/ci/scripts/free-disk-space-linux.sh +++ b/src/ci/scripts/free-disk-space-linux.sh @@ -21,7 +21,7 @@ isX86() { } # Check if we're on a GitHub hosted runner. -# In aws codebuild, the variable RUNNER_ENVIRONMENT is "self-hosted". +# In self hosted runners, the variable RUNNER_ENVIRONMENT is "self-hosted". isGitHubRunner() { # `:-` means "use the value of RUNNER_ENVIRONMENT if it exists, otherwise use an empty string". if [[ "${RUNNER_ENVIRONMENT:-}" == "github-hosted" ]]; then