Pier Angelo Vendrame pushed to branch mullvad-browser-128.6.0esr-14.5-1 at The 
Tor Project / Applications / Mullvad Browser


Commits:
cc778f7c by Beatriz Rizental at 2025-01-27T17:42:14+01:00
fixup! Add CI for Base Browser

- - - - -


3 changed files:

- .gitlab-ci.yml
- .gitlab/ci/jobs/lint/lint.yml
- + .gitlab/ci/mixins.yml


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -7,5 +7,6 @@ variables:
   LOCAL_REPO_PATH: /srv/apps-repos/tor-browser.git
 
 include:
+  - local: '.gitlab/ci/mixins.yml'
   - local: '.gitlab/ci/jobs/lint/lint.yml'
   - local: '.gitlab/ci/jobs/update-translations.yml'


=====================================
.gitlab/ci/jobs/lint/lint.yml
=====================================
@@ -1,11 +1,10 @@
 .base:
+  extends: .with-local-repo-bash
   stage: lint
   image: $IMAGE_PATH
   interruptible: true
   variables:
     MOZBUILD_STATE_PATH: "$CI_PROJECT_DIR/.cache/mozbuild"
-    # A copy of the repository already is available in the runner.
-    GIT_STRATEGY: "none"
   cache:
     paths:
       - node_modules
@@ -17,19 +16,6 @@
   tags:
     # Run these jobs in the browser dedicated runners.
     - firefox
-  before_script:
-    - git init
-    - git remote add local "$LOCAL_REPO_PATH"
-    - git fetch --depth 500 local
-    - git remote add origin "$CI_REPOSITORY_URL"
-    - |
-      if [ -z "${CI_COMMIT_BRANCH:-$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}" ]; 
then
-          echo "No branch specified. Stopping the pipeline."
-          exit 1
-      fi
-    - echo "Fetching from remote branch 
${CI_COMMIT_BRANCH:-$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}"
-    - git fetch origin 
"${CI_COMMIT_BRANCH:-$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}"
-    - git checkout 
origin/${CI_COMMIT_BRANCH:-$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}
 
 eslint:
   extends: .base


=====================================
.gitlab/ci/mixins.yml
=====================================
@@ -0,0 +1,47 @@
+.with-local-repo-bash:
+  variables:
+      GIT_STRATEGY: "none"
+  before_script:
+    - git init
+    - git remote add local "$LOCAL_REPO_PATH"
+    - git fetch --depth 500 local
+    - git remote add origin "$CI_REPOSITORY_URL"
+    - |
+      if [ -z "${CI_COMMIT_BRANCH:-$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}" ]; 
then
+          echo "No branch specified. Stopping the pipeline."
+          exit 1
+      fi
+    - echo "Fetching from remote branch 
${CI_COMMIT_BRANCH:-$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}"
+    - |
+      if ! git fetch origin 
"${CI_COMMIT_BRANCH:-$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}"; then
+            echo -e "\e[31mFetching failed for branch 
${CI_COMMIT_BRANCH:-$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME} from 
$CI_REPOSITORY_URL.\e[0m"
+            echo "Attempting to fetch the merge request branch, assuming this 
pipeline is not running in a fork."
+            git fetch origin "merge-requests/${CI_MERGE_REQUEST_IID}/head"
+      fi
+    - git checkout 
origin/${CI_COMMIT_BRANCH:-$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}
+
+.with-local-repo-pwsh:
+  variables:
+      GIT_STRATEGY: "none"
+  before_script:
+    - git init
+    - git remote add local $env:LOCAL_REPO_PATH
+    - git fetch --depth 500 local
+    - git remote add origin $env:CI_REPOSITORY_URL
+    - |
+      $branchName = $env:CI_COMMIT_BRANCH
+      if ([string]::IsNullOrEmpty($branchName)) {
+          $branchName = $env:CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
+      }
+      if ([string]::IsNullOrEmpty($branchName)) {
+          Write-Output "No branch specified. Stopping the pipeline."
+          exit 1
+      }
+    - Write-Output "Fetching from remote branch $branchName"
+    - |
+      if (! git fetch origin $branchName) {
+        Write-Output "Fetching failed for branch $branchName from 
$env:CI_REPOSITORY_URL."
+        Write-Output "Attempting to fetch the merge request branch, assuming 
this pipeline is not running in a fork."
+        git fetch origin "merge-requests/$env:CI_MERGE_REQUEST_IID/head"
+      }
+    - git checkout origin/$branchName



View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/cc778f7c33eb2f830de606e9451e82d11aa6cf9c

-- 
View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/cc778f7c33eb2f830de606e9451e82d11aa6cf9c
You're receiving this email because of your account on gitlab.torproject.org.


_______________________________________________
tbb-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to