Skip to content

Commit

Permalink
fix: correct asdf inclusion in $PATH (#1043)
Browse files Browse the repository at this point in the history
* fix: correct asdf inclusion in $PATH

* debug: add -x flag

* debug: run `asdf list` before goss

* Update provisioning/ubuntu-provision.sh

* more debug

* remove -i

* wip regex with 1

* chore wip regexp

* wip

* WIP escaping ()

* escaping double quotes

* Update provisioning/ubuntu-provision.sh

Co-authored-by: Damien Duportal <[email protected]>

* Apply suggestions from code review

Co-authored-by: Damien Duportal <[email protected]>

* reverse install order between ruby and vagrant

* remove goss check for version for ruby

---------

Co-authored-by: Stéphane MERLE <[email protected]>
Co-authored-by: smerle33 <[email protected]>
Co-authored-by: Damien Duportal <[email protected]>
  • Loading branch information
4 people authored Feb 13, 2024
1 parent 980b408 commit 83fe58a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions goss/goss-common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ command:
ruby:
exec: ruby -v
exit-status: 0
stdout:
- 2.6.10
# https://github.com/jenkins-infra/packer-images/pull/1043#pullrequestreview-1878135249
# stdout:
# - 2.6.10
terraform:
exec: terraform -v
exit-status: 0
Expand Down
5 changes: 3 additions & 2 deletions provisioning/ubuntu-provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ function install_asdf() {
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
## https://backreference.org/2010/02/20/using-different-delimiters-in-sed/index.html
sed --in-place --regexp-extended "s|^PATH=(.*)\"$|PATH=\1:${asdf_install_dir}/shims:${asdf_install_dir}/bin\"|" /etc/environment
}

## Install the ASDF Plugin passed as argument ($1 is the name and $2 the URL)
Expand Down Expand Up @@ -708,8 +709,8 @@ function main() {
install_gh
install_golang
install_golangcilint # must come after golang
install_vagrant
install_ruby
install_vagrant
install_xq
install_yq
install_packer
Expand Down

0 comments on commit 83fe58a

Please sign in to comment.