Merge branch '79-yarn-1-from-npm' into 'master'

Use npm repo instead of apt on Yarn install

Closes #79

See merge request gitlab-org/gitlab-build-images!397
This commit is contained in:
Mike Greiling 2021-04-27 16:38:36 +00:00
commit 0dc406c14b
4 changed files with 10 additions and 11 deletions

View file

@ -7,7 +7,7 @@ MAINTAINER GitLab Quality Team
ENV LC_ALL "C.UTF-8"
ENV NODE_VERSION=14.16.1
ENV YARN_VERSION=1.22.5-1
ENV YARN_VERSION=1.22.10
ENV GITLAB_GEM_VERSION=4.16.1
ENV DANGER_GEM_VERSION=8.2.2
ENV DANGER_GITLAB_GEM_VERSION=8.0.0

View file

@ -133,10 +133,10 @@ function print_node_args() {
function print_yarn_args() {
case "$1" in
1.12) YARN_INSTALL_VERSION=1.12.3-1 ;;
1.16) YARN_INSTALL_VERSION=1.16.0-1 ;;
1.21) YARN_INSTALL_VERSION=1.21.1-1 ;;
1.22) YARN_INSTALL_VERSION=1.22.5-1 ;;
1.12) YARN_INSTALL_VERSION=1.12.3 ;;
1.16) YARN_INSTALL_VERSION=1.16.0 ;;
1.21) YARN_INSTALL_VERSION=1.21.1 ;;
1.22) YARN_INSTALL_VERSION=1.22.10 ;;
*) echo "Unknown yarn version $1"; exit 1;
esac
printf -- "--build-arg YARN_INSTALL_VERSION=%s " "$YARN_INSTALL_VERSION"

View file

@ -3,15 +3,13 @@ set -xeuo pipefail
IFS=$'\n\t'
NODE_INSTALL_VERSION=${1:-14.16.0}
YARN_INSTALL_VERSION=${2:-1.21.1-1}
YARN_INSTALL_VERSION=${2:-1.22.10}
# Map MAJOR.MINOR.patch -> MAJOR.x
NODE_MAJOR=`echo $NODE_INSTALL_VERSION | sed -r -e "s/([0-9]+)\.[0-9]+.*/\1\.x/g"`
# add official debian repos for node and yarn
# add official debian repos for node
curl -sS -L https://deb.nodesource.com/setup_${NODE_MAJOR} | bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
apt-get update
@ -20,7 +18,8 @@ curl -s -O "https://deb.nodesource.com/node_$NODE_MAJOR/pool/main/n/nodejs/$NODE
dpkg -i "$NODE_FILE_NAME"
rm -f "$NODE_FILE_NAME"
apt-get install -y yarn=$YARN_INSTALL_VERSION
npm install --global yarn@${YARN_INSTALL_VERSION}
npm cache clean --force
apt-get autoremove -yq
apt-get clean -yqq

View file

@ -27,7 +27,7 @@ apt-get install -yq --no-install-recommends imagemagick
# Install node & yarn
NODE_INSTALL_VERSION=12.4.0
YARN_INSTALL_VERSION=1.21.1-1
YARN_INSTALL_VERSION=1.22.10
/scripts/install-node $NODE_INSTALL_VERSION $YARN_INSTALL_VERSION && node --version && yarn --version
# Install yamllint