Skip to content

Commit

Permalink
Optimize package manager install step for GitLab CI
Browse files Browse the repository at this point in the history
* Try reverting to dashboard image

* Try reverting to original path for Bundler

* Temporary: Avoid pulling cache for install

Assumption that the cache may be invalid given changes to paths

* Remove gitlab-ci.yml from files

Max 2 items in file key

* Include .gitlab-ci.yml in dependency cache key

Since it may alter what paths are included in the cache

* Set deployment via bundle config

Resolve deprecation message:

"[DEPRECATED] The `--deployment` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set deployment true`, and stop using this flag"

* Remove --without flag for bundler

Currently no groups defined in Gemfile

* Use default bundle path for depdencies

Avoid needing to specify extra flag

Ref: https://bundler.io/v2.5/man/bundle-install.1.html#DEPLOYMENT-MODE

"Gems are installed to vendor/bundle not your default system location"

* Remove extra check step for bundler

Seems redundant / repeated, and likely to reduce overall performance

* Flatten path for bundler dependencies

* Remove NVM and Bundler install steps

Assumed to be the version we want via IdP image

* Use latest IdP image for CI
  • Loading branch information
aduth committed Jul 3, 2024
1 parent 8adf1ef commit 5acd732
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Jobs defined here use the idp/ci docker image from ECR by default.
# Jobs defined here use the dashboard/ci docker image from ECR by default.
# Images are built via the identity-devops GitLab pipeline.

variables:
Expand All @@ -21,19 +21,13 @@ stages:
- Gemfile.lock
- package-lock.json
paths:
- vendor/ruby
- vendor/bundle
- .npm-cache/
policy: pull

.bundle_npm_install: &bundle_npm_install
- export BASH_ENV="$HOME/.bash.env"
- wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/$NVM_VERSION/install.sh | bash
- export NVM_DIR="$HOME/.nvm"
- . "$NVM_DIR/nvm.sh" --install --latest-npm
- echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV
- echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
- gem install bundler --version $BUNDLER_VERSION
- bundle check || bundle install --deployment --jobs=4 --retry=3 --without deploy development doc production --path vendor/ruby
- bundle config set deployment true
- bundle install --jobs=4 --retry=3
- npm ci --cache .npm-cache --prefer-offline

install:
Expand Down

0 comments on commit 5acd732

Please sign in to comment.