Skip to content

Commit 8a28f15

Browse files
authored
build: remove unnecessary env.sh logic for circleci (#23054)
In the past, when the `checkout_and_rebase` command has been ported from `angular/angular` to the components repo, the `env.sh` w/ `env-helper.inc.sh` scripts have been integrated too. The goal of these scripts is to setup the environment for CircleCI in a CI-agnostic way. Since the only logic relying on the `env.sh` file is the `rebase-pr` script, we can just update the script (located in `.circleci/`) to point directly to the CircleCI variables. This is more readable and makes the CI less convoluted. Especially since the `env.sh` script currently performs duplicate work like settign up the RBE/GCP token. A separate script is already invoked for this using the `*setup_bazel_rbe` YAML macro.
1 parent 2458d30 commit 8a28f15

File tree

4 files changed

+16
-134
lines changed

4 files changed

+16
-134
lines changed

.circleci/config.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,12 @@ commands:
157157
description: Checkout and rebase the repository
158158
steps:
159159
- checkout
160-
- run:
161-
name: Set up environment
162-
environment:
163-
CIRCLE_GIT_BASE_REVISION: << pipeline.git.base_revision >>
164-
CIRCLE_GIT_REVISION: << pipeline.git.revision >>
165-
command: ./.circleci/env.sh
160+
# After checkout, rebase on top of target branch.
166161
- run:
167162
name: Rebase PR on target branch
168-
# After checkout, rebase on top of target branch.
163+
environment:
164+
CIRCLE_GIT_BASE_REVISION: << pipeline.git.base_revision >>
165+
CIRCLE_GIT_REVISION: << pipeline.git.revision >>
169166
command: |
170167
if [ -n "$CIRCLE_PR_NUMBER" ]; then
171168
# User is required for rebase.

.circleci/env-helpers.inc.sh

Lines changed: 0 additions & 73 deletions
This file was deleted.

.circleci/env.sh

Lines changed: 0 additions & 52 deletions
This file was deleted.

.circleci/rebase-pr.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,18 @@ function getRefAndShas(sha, owner, name) {
184184

185185
/** Gets the refs and shas for the base and target of the current environment. */
186186
function getRefsAndShasForChange() {
187-
const base = getRefAndShas(process.env['CI_GIT_BASE_REVISION'], process.env['CI_REPO_OWNER'], process.env['CI_REPO_NAME']);
188-
const target = getRefAndShas(process.env['CI_GIT_REVISION'], process.env['CI_PR_USERNAME'], process.env['CI_PR_REPONAME']);
187+
const base = getRefAndShas(
188+
process.env['CIRCLE_GIT_BASE_REVISION'],
189+
process.env['CIRCLE_PROJECT_USERNAME'],
190+
process.env['CIRCLE_PROJECT_REPONAME']
191+
);
192+
193+
const target = getRefAndShas(
194+
process.env['CIRCLE_GIT_REVISION'],
195+
process.env['CIRCLE_PR_USERNAME'],
196+
process.env['CIRCLE_PR_REPONAME']
197+
);
198+
189199
const commonAncestorSha = getCommonAncestorSha(base.sha, target.sha);
190200
return {
191201
base,

0 commit comments

Comments
 (0)