Browse Source

Merge "Use node v10 instead of node v8"

tags/3.6.0
Zuul 5 months ago
parent
commit
024537e4ec
4 changed files with 155 additions and 47 deletions
  1. 5
    5
      .zuul.yaml
  2. 148
    40
      tools/install-js-repos-rpm.sh
  3. 1
    1
      tools/install-js-tools.sh
  4. 1
    1
      web/package.json

+ 5
- 5
.zuul.yaml View File

@@ -183,11 +183,11 @@
183 183
         - zuul-build-dashboard-multi-tenant
184 184
         - nodejs-npm-run-lint:
185 185
             vars:
186
-              node_version: 8
186
+              node_version: 10
187 187
               zuul_work_dir: "{{ zuul.project.src_dir }}/web"
188 188
         - nodejs-npm-run-test:
189 189
             vars:
190
-              node_version: 8
190
+              node_version: 10
191 191
               zuul_work_dir: "{{ zuul.project.src_dir }}/web"
192 192
             success-url: 'npm/reports/bundle.html'
193 193
             files:
@@ -214,11 +214,11 @@
214 214
         - zuul-build-dashboard
215 215
         - nodejs-npm-run-lint:
216 216
             vars:
217
-              node_version: 8
217
+              node_version: 10
218 218
               zuul_work_dir: "{{ zuul.project.src_dir }}/web"
219 219
         - nodejs-npm-run-test:
220 220
             vars:
221
-              node_version: 8
221
+              node_version: 10
222 222
               zuul_work_dir: "{{ zuul.project.src_dir }}/web"
223 223
             success-url: 'npm/reports/bundle.html'
224 224
             files:
@@ -233,7 +233,7 @@
233 233
         - publish-zuul-python-branch-tarball
234 234
         - publish-openstack-javascript-content:
235 235
             vars:
236
-              node_version: 8
236
+              node_version: 10
237 237
               zuul_work_dir: "{{ zuul.project.src_dir }}/web"
238 238
               create_tarball_directory: build
239 239
     promote:

+ 148
- 40
tools/install-js-repos-rpm.sh View File

@@ -22,25 +22,62 @@
22 22
 
23 23
 # The above license is inferred from the
24 24
 # https://github.com/nodesource/distributions source repository.
25
-
26 25
 # Discussion, issues and change requests at:
27 26
 #   https://github.com/nodesource/distributions
28 27
 #
29
-# Script to install the NodeSource Node.js 8.x repo onto an
28
+# Script to install the NodeSource Node.js 10.x repo onto an
30 29
 # Enterprise Linux or Fedora Core based system.
31 30
 #
32
-# Run as root or insert `sudo -E` before `bash`:
33
-#
34
-# This was downloaded from https://rpm.nodesource.com/setup_8.x
31
+# This was downloaded from https://rpm.nodesource.com/setup_10.x
35 32
 # A few modifications have been made.
36 33
 
34
+SCRSUFFIX="_10.x"
35
+NODENAME="Node.js 10.x"
36
+NODEREPO="pub_10.x"
37
+NODEPKG="nodejs"
38
+
37 39
 print_status() {
38
-  local outp=$(echo "$1" | sed -r 's/\\n/\\n## /mg')
40
+  local outp=$(echo "$1") # | sed -r 's/\\n/\\n## /mg')
39 41
   echo
40 42
   echo -e "## ${outp}"
41 43
   echo
42 44
 }
43 45
 
46
+if test -t 1; then # if terminal
47
+    ncolors=$(which tput > /dev/null && tput colors) # supports color
48
+    if test -n "$ncolors" && test $ncolors -ge 8; then
49
+        termcols=$(tput cols)
50
+        bold="$(tput bold)"
51
+        underline="$(tput smul)"
52
+        standout="$(tput smso)"
53
+        normal="$(tput sgr0)"
54
+        black="$(tput setaf 0)"
55
+        red="$(tput setaf 1)"
56
+        green="$(tput setaf 2)"
57
+        yellow="$(tput setaf 3)"
58
+        blue="$(tput setaf 4)"
59
+        magenta="$(tput setaf 5)"
60
+        cyan="$(tput setaf 6)"
61
+        white="$(tput setaf 7)"
62
+    fi
63
+fi
64
+
65
+print_bold() {
66
+    title="$1"
67
+    text="$2"
68
+
69
+    echo
70
+    echo "${red}================================================================================${normal}"
71
+    echo "${red}================================================================================${normal}"
72
+    echo
73
+    echo -e "  ${bold}${yellow}${title}${normal}"
74
+    echo
75
+    echo -en "  ${text}"
76
+    echo
77
+    echo "${red}================================================================================${normal}"
78
+    echo "${red}================================================================================${normal}"
79
+}
80
+
44 81
 bail() {
45 82
   echo 'Error executing command, exiting'
46 83
   exit 1
@@ -55,18 +92,88 @@ exec_cmd() {
55 92
   exec_cmd_nobail "$1" || bail
56 93
 }
57 94
 
58
-print_status "Installing the NodeSource Node.js 8.x repo..."
95
+node_deprecation_warning() {
96
+    if [[ "X${NODENAME}" == "Xio.js 1.x" ||
97
+          "X${NODENAME}" == "Xio.js 2.x" ||
98
+          "X${NODENAME}" == "Xio.js 3.x" ||
99
+          "X${NODENAME}" == "XNode.js 0.10" ||
100
+          "X${NODENAME}" == "XNode.js 0.12" ||
101
+          "X${NODENAME}" == "XNode.js 4.x LTS Argon" ||
102
+          "X${NODENAME}" == "XNode.js 5.x" ||
103
+          "X${NODENAME}" == "XNode.js 7.x" ]]; then
104
+
105
+        print_bold \
106
+"                            DEPRECATION WARNING                            " "\
107
+${bold}${NODENAME} is no longer actively supported!${normal}
108
+
109
+  ${bold}You will not receive security or critical stability updates${normal} for this version.
110
+
111
+  You should migrate to a supported version of Node.js as soon as possible.
112
+  Use the installation script that corresponds to the version of Node.js you
113
+  wish to install. e.g.
114
+
115
+   * ${green}https://deb.nodesource.com/setup_8.x — Node.js v8 LTS \"Carbon\"${normal} (recommended)
116
+   * ${green}https://deb.nodesource.com/setup_10.x — Node.js v10 Current${normal}
117
+
118
+  Please see ${bold}https://github.com/nodejs/Release${normal} for details about which
119
+  version may be appropriate for you.
120
+
121
+  The ${bold}NodeSource${normal} Node.js distributions repository contains
122
+  information both about supported versions of Node.js and supported Linux
123
+  distributions. To learn more about usage, see the repository:
124
+    ${bold}https://github.com/nodesource/distributions${normal}
125
+"
126
+        echo
127
+        echo "Continuing in 20 seconds ..."
128
+        echo
129
+        sleep 20
130
+    fi
131
+}
132
+
133
+script_deprecation_warning() {
134
+    if [ "X${SCRSUFFIX}" == "X" ]; then
135
+        print_bold \
136
+"                         SCRIPT DEPRECATION WARNING                         " "\
137
+This script, located at ${bold}https://rpm.nodesource.com/setup${normal}, used to
138
+  install Node.js v0.10, is deprecated and will eventually be made inactive.
139
+
140
+  You should use the script that corresponds to the version of Node.js you
141
+  wish to install. e.g.
142
+
143
+   * ${green}https://deb.nodesource.com/setup_8.x — Node.js v8 LTS \"Carbon\"${normal} (recommended)
144
+   * ${green}https://deb.nodesource.com/setup_10.x — Node.js v10 Current${normal}
145
+
146
+  Please see ${bold}https://github.com/nodejs/Release${normal} for details about which
147
+  version may be appropriate for you.
148
+
149
+  The ${bold}NodeSource${normal} Node.js Linux distributions GitHub repository contains
150
+  information about which versions of Node.js and which Linux distributions
151
+  are supported and how to use the install scripts.
152
+    ${bold}https://github.com/nodesource/distributions${normal}
153
+"
154
+
155
+        echo
156
+        echo "Continuing in 20 seconds (press Ctrl-C to abort) ..."
157
+        echo
158
+        sleep 20
159
+    fi
160
+}
161
+
162
+setup() {
163
+
164
+script_deprecation_warning
165
+node_deprecation_warning
166
+
167
+print_status "Installing the NodeSource ${NODENAME} repo..."
59 168
 
60 169
 print_status "Inspecting system..."
61 170
 
62 171
 if [ ! -x /bin/rpm ]; then
63
-  print_status "\
64
-You don't appear to be running an Enterprise Linux based \
65
-system, please contact NodeSource at \
66
-https://github.com/nodesource/distributions/issues if you think this \
67
-is incorrect or would like your distribution to be considered for \
68
-support.\
69
-"
172
+  print_status """You don't appear to be running an Enterprise Linux based system,
173
+please contact NodeSource at https://github.com/nodesource/distributions/issues
174
+if you think this is incorrect or would like your distribution to be considered
175
+for support.
176
+"""
70 177
   exit 1
71 178
 fi
72 179
 
@@ -98,7 +205,7 @@ fi
98 205
 
99 206
 if [[ $DISTRO_PKG =~ ^(redhat|centos|cloudlinux|sl)- ]]; then
100 207
     DIST_TYPE=el
101
-elif [[ $DISTRO_PKG =~ ^system-release- ]]; then # Amazon Linux
208
+elif [[ $DISTRO_PKG =~ ^(enterprise|system)-release- ]]; then # Oracle Linux & Amazon Linux
102 209
     DIST_TYPE=el
103 210
 elif [[ $DISTRO_PKG =~ ^(fedora|korora)- ]]; then
104 211
     DIST_TYPE=fc
@@ -115,7 +222,7 @@ Include your 'distribution package' name: ${DISTRO_PKG}. \
115 222
 
116 223
 fi
117 224
 
118
-if [[ $DISTRO_PKG =~ ^system-release-201[4-9]\. ]]; then  #NOTE: not really future-proof
225
+if [[ $DISTRO_PKG =~ ^system-release ]]; then
119 226
 
120 227
   # Amazon Linux, for 2014.* use el7, older versions are unknown, perhaps el6
121 228
   DIST_VERSION=7
@@ -124,7 +231,7 @@ else
124 231
 
125 232
   ## Using the redhat-release-server-X, centos-release-X, etc. pattern
126 233
   ## extract the major version number of the distro
127
-  DIST_VERSION=$(echo $DISTRO_PKG | sed -r 's/^[[:alpha:]]+-release(-server|-workstation)?-([0-9]+).*$/\2/')
234
+  DIST_VERSION=$(echo $DISTRO_PKG | sed -r 's/^[[:alpha:]]+-release(-server|-workstation|-client)?-([0-9]+).*$/\2/')
128 235
 
129 236
   if ! [[ $DIST_VERSION =~ ^[0-9][0-9]?$ ]]; then
130 237
 
@@ -147,7 +254,7 @@ fi
147 254
 ## we include the arch in the directory tree anyway)
148 255
 RELEASE_URL_VERSION_STRING="${DIST_TYPE}${DIST_VERSION}"
149 256
 RELEASE_URL="\
150
-https://rpm.nodesource.com/pub_8.x/\
257
+https://rpm.nodesource.com/${NODEREPO}/\
151 258
 ${DIST_TYPE}/\
152 259
 ${DIST_VERSION}/\
153 260
 ${DIST_ARCH}/\
@@ -193,15 +300,14 @@ if [ "$DIST_TYPE" == "el" ] && [ "$DIST_VERSION" == "5" ]; then
193 300
       exit 1
194 301
     fi
195 302
 
196
-    print_status "\
197
-The EPEL (Extra Packages for Enterprise Linux) repository is a\n\
198
-prerequisite for installing Node.js on your operating system. Please\n\
199
-add it and re-run this setup script.\n\
200
-\n\
201
-The EPEL repository RPM is available at:\n\
202
-  ${epel_url}${epel}\n\
203
-You can try installing with: \`rpm -ivh <url>\`\
204
-"
303
+    print_status """The EPEL (Extra Packages for Enterprise Linux) repository is a
304
+prerequisite for installing Node.js on your operating system. Please
305
+add it and re-run this setup script.
306
+
307
+The EPEL repository RPM is available at:
308
+  ${epel_url}${epel}
309
+You can try installing with: \`rpm -ivh <url>\`
310
+"""
205 311
 
206 312
     exit 1
207 313
   fi
@@ -236,21 +342,23 @@ EXISTING_NODE=$(rpm -qa 'node|npm|iojs' | grep -v nodesource)
236 342
 
237 343
 if [ "X${EXISTING_NODE}" != "X" ]; then
238 344
 
239
-  # NOTE(mordred) Removed -y from the yum command below.
240
-  print_status "\
241
-Your system appears to already have Node.js installed from an alternative source.\n\
242
-Run \`\033[1myum remove nodejs npm\033[22m\` (as root) to remove these first.\
243
-"
345
+  print_status """Your system appears to already have Node.js installed from an alternative source.
346
+Run \`${bold}sudo yum remove -y ${NODEPKG} npm${normal}\` to remove these first.
347
+"""
244 348
 
245 349
 fi
246 350
 
247
-# NOTE(mordred) Removed -y from the yum commands below.
248
-print_status "\
249
-Run \`\033[1myum install nodejs\033[22m\` (as root) to install Node.js 8.x and npm.\n\
250
-You may also need development tools to build native addons:\n\
251
-  \`yum install gcc-c++ make\`\
252
-"
253
-
254
-## Alternative to install dev tools: `yum groupinstall 'Development Tools'
351
+print_status """Run \`${bold}sudo yum install -y ${NODEPKG}${normal}\` to install ${NODENAME} and npm.
352
+## You may also need development tools to build native addons:
353
+     sudo yum install gcc-c++ make
354
+## To install the Yarn package manager, run:
355
+     curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
356
+     sudo yum install yarn
357
+"""
255 358
 
256 359
 exit 0
360
+
361
+}
362
+
363
+## Defer setup until we have the complete script
364
+setup

+ 1
- 1
tools/install-js-tools.sh View File

@@ -25,7 +25,7 @@ if type apt-get; then
25 25
     $SUDO apt-get install -y apt-transport-https curl gnupg2
26 26
     # Install recent NodeJS repo
27 27
     curl -sS https://deb.nodesource.com/gpgkey/nodesource.gpg.key | $SUDO apt-key add -
28
-    echo "deb https://deb.nodesource.com/node_8.x xenial main" | $SUDO tee /etc/apt/sources.list.d/nodesource.list
28
+    echo "deb https://deb.nodesource.com/node_10.x bionic main" | $SUDO tee /etc/apt/sources.list.d/nodesource.list
29 29
     # Install yarn repo
30 30
     curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | $SUDO apt-key add -
31 31
     echo "deb https://dl.yarnpkg.com/debian/ stable main" | $SUDO tee /etc/apt/sources.list.d/yarn.list

+ 1
- 1
web/package.json View File

@@ -1,7 +1,7 @@
1 1
 {
2 2
   "name": "@zuul-ci/dashboard",
3 3
   "version": "1.0.0",
4
-  "description": "Web Dashboard for Zuul",
4
+  "description": "Zuul Web Dashboard",
5 5
   "repository": "https://git.zuul-ci.org/zuul",
6 6
   "author": "Zuul Developers",
7 7
   "license": "Apache-2.0",

Loading…
Cancel
Save