From 043677fe225f80587abf78f9a2bab3acf7676f81 Mon Sep 17 00:00:00 2001
From: Bryan Richter <bryan@haskell.foundation>
Date: Fri, 17 Nov 2023 10:53:36 +0200
Subject: [PATCH] Centralize call to setup-nix-environment

before_script and script just get merged, so unless we're setting some
default somewhere we don't need it. And in fact, every user of .build
was doing the same thing, so we can just do it in one place: .build.
---
 ci/pipelines/downstream.yml              | 3 ---
 ci/pipelines/lib/run-head-hackage-ci.yml | 5 ++---
 ci/pipelines/update-repo.yml             | 4 +---
 ci/pipelines/validation.yml              | 3 ---
 4 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/ci/pipelines/downstream.yml b/ci/pipelines/downstream.yml
index 0bd5042..9ad148a 100644
--- a/ci/pipelines/downstream.yml
+++ b/ci/pipelines/downstream.yml
@@ -4,9 +4,6 @@ include: ci/pipelines/lib/run-head-hackage-ci.yml
 # A build triggered from a ghc/ghc> pipeline.
 .build-pipeline:
   extends: .build
-  before_script:
-    - source ci/setup-nix-environment.sh
-    - GHC_TARBALL=$(discover_tarball.sh)
   parallel:
     matrix:
       - ARCH: aarch64
diff --git a/ci/pipelines/lib/run-head-hackage-ci.yml b/ci/pipelines/lib/run-head-hackage-ci.yml
index 011a5b0..d4d24ee 100644
--- a/ci/pipelines/lib/run-head-hackage-ci.yml
+++ b/ci/pipelines/lib/run-head-hackage-ci.yml
@@ -8,10 +8,9 @@
 
   image: "nixos/nix:$DOCKER_TAG"
 
-  before_script:
-    - source ci/setup-nix-environment.sh
-
   script:
+    - source ci/setup-nix-environment.sh
+    - GHC_TARBALL=$(discover_tarball.sh)
       # Install GHC
     - echo "Bindist tarball is $GHC_TARBALL"
     - curl -L "$GHC_TARBALL" > ghc.tar.xz
diff --git a/ci/pipelines/update-repo.yml b/ci/pipelines/update-repo.yml
index 69a109a..b58968a 100644
--- a/ci/pipelines/update-repo.yml
+++ b/ci/pipelines/update-repo.yml
@@ -7,9 +7,6 @@ stages:
 update-repo:
   stage: update-repo
 
-  before_script:
-    - source ci/setup-nix-environment.sh
-
   tags:
     - x86_64-linux
 
@@ -20,6 +17,7 @@ update-repo:
     # KEYS_TARBALL_KEY provided by protected variable
 
   script:
+    - source ci/setup-nix-environment.sh
     - build-repo.sh extract-keys
     - build-repo.sh build-repo
 
diff --git a/ci/pipelines/validation.yml b/ci/pipelines/validation.yml
index fb02fa5..3fb2979 100644
--- a/ci/pipelines/validation.yml
+++ b/ci/pipelines/validation.yml
@@ -11,9 +11,6 @@ stages:
 # Build against named GHC versions
 .build-with-ghc:
   extends: .build
-  before_script:
-    - source ci/setup-nix-environment.sh
-    - GHC_TARBALL=$(discover_tarball.sh)
   parallel:
     matrix:
       - UPSTREAM_BRANCH_NAME: [ghc-9.4, ghc-9.6, ghc-9.8]
-- 
GitLab