Skip to content

Commit 1ccd1ee

Browse files
devversionandrewseguin
authored andcommitted
build: fix cronjob snapshot jobs failing (#13595)
* Due to the fact that we modify the `package.json` in cronjobs without updating the actual lock-file, the `--frozen-lockfile` installation fails. In order to fix this, we should just re-install the dependencies after the general `yarn` installation.
1 parent 8c3457b commit 1ccd1ee

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ env:
5252
before_install:
5353
- source ./scripts/ci/travis-env.sh
5454
- source ./scripts/ci/install-yarn.sh
55-
- if [[ "$TRAVIS_EVENT_TYPE" == "cron" ]]; then ./scripts/install-angular-snapshot.sh --only-save; fi
5655

5756
install:
5857
- ./scripts/ci/travis-install.sh
58+
- if [[ "$TRAVIS_EVENT_TYPE" == "cron" ]]; then ./scripts/install-angular-snapshot.sh --only-save; fi
5959

6060
before_script:
6161
- mkdir -p $LOGS_DIR

scripts/install-angular-snapshot.sh

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
11
#!/bin/bash
22

3-
# Script that modifies the project `package.json` by setting the version for all Angular
4-
# dependencies to the Github snapshot builds. Afterwards, if the `--only-save` flag is not set,
5-
# the script will also run NPM to install the new versions.
6-
3+
# Script that re-installs all Angular dependencies using the GitHub build snapshots. We need to
4+
# this after the locked node modules have been installed because otherwise `--frozen-lockfile`
5+
# would complain about outdated lock files.
76
set -e
87

98
# Go to the project root directory
109
cd $(dirname $0)/../
1110

12-
searchRegex='(@angular\/(.*))":\s+".*"'
13-
searchReplace='\1": "github:angular\/\2-builds"'
14-
15-
# Replace the Angular versions in `package.json` with their corresponding
16-
# build snapshots so that we only have to run `npm install` once.
17-
sed -i -r "s/${searchRegex}/${searchReplace}/g" package.json
18-
19-
if [[ ${*} != *--only-save* ]]; then
20-
npm install
21-
fi
11+
yarn add \
12+
$(awk 'match($0, "@angular/(.*)\":", m){print "github:angular/"m[1]"-builds"}' package.json)

0 commit comments

Comments
 (0)