Skip to content

Commit

Permalink
Merge pull request #1021 from smerle33/correct/npm/node
Browse files Browse the repository at this point in the history
feat(node): change npm version check and add asdf to path
  • Loading branch information
smerle33 authored Jan 30, 2024
2 parents 2e04a24 + 60b3767 commit 2dce9a8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
7 changes: 6 additions & 1 deletion goss/goss-common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,14 @@ command:
exit-status: 0
stdout:
- 18.18.2
# and:
# - contain: 18.18.2
# - not: 'Please install a version by running one of the following'
npm:
exec: npm version
exec: npm --version
exit-status: 0
# stdout:
# - not: 'No preset version installed for command npm'
packer:
exec: packer -v
exit-status: 0
Expand Down
5 changes: 4 additions & 1 deletion provisioning/ubuntu-provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ function install_asdf() {
echo ". ${asdf_install_dir}/asdf.sh" >> "${profile_script}"
chown -R "${username}:${groupname}" "${userhome}"
rm -f "${archive}"

## append to the system wide path variable, need to be seconded for docker in packer sources.pkr.hcl
sed -e "/^PATH/s/\"$/:\${asdf_install_dir}\/shims:\${asdf_install_dir}\/bin\"/g" -i /etc/environment
}

## Install the ASDF Plugin passed as argument ($1 is the name and $2 the URL)
Expand Down Expand Up @@ -205,7 +208,7 @@ function install_golang(){
golang_download_url="https://go.dev/dl/go${GOLANG_VERSION}.linux-${ARCHITECTURE}.tar.gz"
curl --fail --silent --show-error --location "${golang_download_url}" | \
tar --extract --gunzip --directory="/usr/local/"
## append to the system wide path variable
## append to the system wide path variable, need to be seconded for docker in packer sources.pkr.hcl
sed -e '/^PATH/s/"$/:\/usr\/local\/go\/bin"/g' -i /etc/environment
}

Expand Down
2 changes: 1 addition & 1 deletion sources.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ source "docker" "base" {
"ENV LANGUAGE=${element(split(".", var.locale), 0)}:${element(split("_", var.locale), 0)}",
"ENV LC_ALL=${var.locale}",
"ENV AGENT_WORKDIR=/home/jenkins/agent",
"ENV PATH=$${PATH}:/usr/local/go/bin",
"ENV PATH=$${PATH}:/usr/local/go/bin:/home/jenkins/.asdf/shims:/home/jenkins/.asdf/bin",
"WORKDIR /home/jenkins",
"ENTRYPOINT [\"/usr/local/bin/jenkins-agent\"]",
"USER jenkins",
Expand Down

0 comments on commit 2dce9a8

Please sign in to comment.