From 5fa436ccc659f39652ea6e3c318e4c7fe64f5a62 Mon Sep 17 00:00:00 2001
From: Geoffrey Arthaud <geoffrey.arthaud@developpement-durable.gouv.fr>
Date: Wed, 28 Feb 2024 00:26:25 +0100
Subject: [PATCH] Reduce cargo parallelism to avoid OpenSSL build failure

---
 .gitlab-ci.yml | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index efedc6e..95fa3fa 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -12,16 +12,12 @@ check-format:
   script:
     - rustup component add rustfmt
     - cargo fmt --all -- --check
-  tags:
-    - buildonly
 
 test-rust-latest:
   stage: build_test
   image: rust:latest
   script:
     - cargo test --verbose
-  tags:
-    - buildonly
 
 test-rust-nightly:
   stage: build_test
@@ -29,8 +25,6 @@ test-rust-nightly:
   script:
     - cargo test --verbose
   allow_failure: true
-  tags:
-    - buildonly
 
 .rust-release:
   stage: release
@@ -38,7 +32,7 @@ test-rust-nightly:
     TARGET: target/$TARGET_ARCH/release/gitlab-project-doctor
   script:
     - rustup target add $TARGET_ARCH
-    - cargo build --target $TARGET_ARCH --release
+    - cargo build $CARGO_OPTS --target $TARGET_ARCH --release
     - strip $TARGET
     - $LDD_CMD $TARGET
     - $TARGET --help
@@ -55,26 +49,24 @@ release-linux:
   before_script:
     - apt update -y
     - apt install -y musl-dev musl-tools build-essential
-  tags:
-    - buildonly
 
 release-macos-silicon:
   extends: .rust-release
   variables:
     TARGET_ARCH: aarch64-apple-darwin
+    CARGO_OPTS: -j 1 # Excessive parallelism causes OpenSSL build to fail
     LDD_CMD: otool -L
   tags:
     - macos_mx
-  retry: 1 # First-time OpenSSL build will fail rust build
 
 release-macos-x86:
   extends: .rust-release
   variables:
     TARGET_ARCH: x86_64-apple-darwin
+    CARGO_OPTS: -j 1 # Excessive parallelism causes OpenSSL build to fail
     LDD_CMD: otool -L
   tags:
     - macos_mx
-  retry: 1 # First-time OpenSSL build will fail rust build
 
 docker_build:
   stage: deploy
@@ -82,7 +74,5 @@ docker_build:
     COMMIT_CREATE_LATEST: "true"
     IMAGE_TAG: "v1.19.2-debug"
   retry: 2
-  dependencies:
+  needs:
     - release-linux
-  tags:
-    - buildonly
\ No newline at end of file
-- 
GitLab