Browse Source

build: fix release CI jobs start script (#31026)

* build: fix release CI jobs start script

This broke in #30492, we weren't handled 20X status codes and weren't authing to appveyor correctly.

* build: do not pass undefined to Auth header in CI scripts

(cherry picked from commit a48968c1ce2fbe320c67623ba3f16e8ccbcb1944)

* build: use basic auth to trigger CI if either a username OR password is provided

(cherry picked from commit d1bd9afbbfb87c47836441651839d7112ba89d33)

* build: manually pull 64bit dugite for 32bit tests (#30531)

(cherry picked from commit 8b9d0092cb5a36847877df987f3585ed84b6e0cd)

Co-authored-by: Samuel Attard <[email protected]>
Co-authored-by: Samuel Attard <[email protected]>
trop[bot] 3 years ago
parent
commit
c6c59bf0b3
2 changed files with 12 additions and 3 deletions
  1. 3 0
      .circleci/config.yml
  2. 9 3
      script/release/ci-release-build.js

+ 3 - 0
.circleci/config.yml

@@ -1209,6 +1209,9 @@ steps-tests: &steps-tests
               (cd electron && node script/yarn test --runners=main --trace-uncaught --enable-logging)
               (cd electron && node script/yarn test --runners=remote --trace-uncaught --enable-logging)
             else
+              if [ "$TARGET_ARCH" == "ia32" ]; then
+                npm_config_arch=x64 node electron/node_modules/dugite/script/download-git.js
+              fi
               (cd electron && node script/yarn test --runners=main --trace-uncaught --enable-logging --files $(circleci tests glob spec-main/*-spec.ts | circleci tests split --split-by=timings))
               (cd electron && node script/yarn test --runners=remote --trace-uncaught --enable-logging --files $(circleci tests glob spec/*-spec.js | circleci tests split --split-by=timings))
             fi

+ 9 - 3
script/release/ci-release-build.js

@@ -36,13 +36,19 @@ const vstsArmJobs = [
 let jobRequestedCount = 0;
 
 async function makeRequest ({ auth, url, headers, body, method }) {
+  const clonedHeaders = {
+    ...(headers || {})
+  };
+  if (auth && auth.bearer) {
+    clonedHeaders.Authorization = `Bearer ${auth.bearer}`;
+  }
   const response = await got(url, {
-    headers,
+    headers: clonedHeaders,
     body,
     method,
-    auth: auth ? `${auth.username}:${auth.password}` : undefined
+    auth: auth && (auth.username || auth.password) ? `${auth.username}:${auth.password}` : undefined
   });
-  if (response.statusCode !== 200) {
+  if (response.statusCode < 200 || response.statusCode >= 300) {
     console.error('Error: ', `(status ${response.statusCode})`, response.body);
     throw new Error(`Unexpected status code ${response.statusCode} from ${url}`);
   }