From fe60a2b7c1338b9d39ef9dc1ca8454a69418eca3 Mon Sep 17 00:00:00 2001 From: timyuer <524860213@qq.com> Date: Mon, 3 Jun 2024 09:54:16 +0800 Subject: [PATCH] BIGTOP-4118: Add nodejs package to bigtop_toolchain --- bigtop_toolchain/manifests/installer.pp | 1 + bigtop_toolchain/manifests/node.pp | 38 +++++++++++++++++++++++++ bigtop_toolchain/templates/jenkins.sh | 3 +- 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 bigtop_toolchain/manifests/node.pp diff --git a/bigtop_toolchain/manifests/installer.pp b/bigtop_toolchain/manifests/installer.pp index bdecb36be2..b3d15d841a 100644 --- a/bigtop_toolchain/manifests/installer.pp +++ b/bigtop_toolchain/manifests/installer.pp @@ -19,6 +19,7 @@ include bigtop_toolchain::maven include bigtop_toolchain::ant include bigtop_toolchain::gradle + include bigtop_toolchain::node include bigtop_toolchain::protobuf include bigtop_toolchain::packages include bigtop_toolchain::python diff --git a/bigtop_toolchain/manifests/node.pp b/bigtop_toolchain/manifests/node.pp new file mode 100644 index 0000000000..a563ccf31b --- /dev/null +++ b/bigtop_toolchain/manifests/node.pp @@ -0,0 +1,38 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +class bigtop_toolchain::node { + case $architecture { + /amd64|x86_64/ : { $arch = "x64" } + 'ppc64le' : { $arch = "ppc64le" } + 'aarch64' : { $arch = "arm64" } + } + $node_version = "16.20.2" + $node_name = "node-v${node_version}-linux-$arch" + $node_dl_url = 'https://nodejs.org/dist/v$node_version/' + + exec { "get node": + command => "/usr/bin/wget -O - https://nodejs.org/dist/v${node_version}/${node_name}.tar.gz | /bin/tar xzf -", + cwd => "/usr/local", + unless => "/usr/bin/test -x /usr/local/${node_name}/bin/npm", + } + + file { "/usr/local/node": + ensure => link, + target => "/usr/local/${node_name}", + require => Exec["get node"], + } + +} diff --git a/bigtop_toolchain/templates/jenkins.sh b/bigtop_toolchain/templates/jenkins.sh index 31e3ecde65..7492742ae9 100644 --- a/bigtop_toolchain/templates/jenkins.sh +++ b/bigtop_toolchain/templates/jenkins.sh @@ -17,6 +17,7 @@ export MAVEN_HOME=/usr/local/maven export JAVA_HOME=<%= @javahome %> export ANT_HOME=/usr/local/ant export GRADLE_HOME=/usr/local/gradle -export PATH=$MAVEN_HOME/bin:$ANT_HOME/bin:$GRADLE_HOME/bin:$PATH +export NODE_HOME=/usr/local/node +export PATH=$MAVEN_HOME/bin:$ANT_HOME/bin:$GRADLE_HOME/bin:$NODE_HOME/bin:$PATH export GRADLE_OPTS="-Dorg.gradle.daemon=true"