Skip to content

Commit

Permalink
chore(goss): moving all sanity checks to goss (#906)
Browse files Browse the repository at this point in the history
* chore(goss): moving all sanity checks to goss

* remove goss retry and add some logs

* adding back installed packages list

* fixup
  • Loading branch information
smerle33 authored Nov 16, 2023
1 parent 61c173f commit bfb779d
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 77 deletions.
2 changes: 1 addition & 1 deletion build-jenkins-agent-ubuntu.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ build {
inline = [
"source /home/jenkins/.asdf/asdf.sh", # Required as this is a non-interactive and non-login `bash`
"goss --version",
"goss --gossfile /tmp/goss-linux.yaml validate --retry-timeout 5s",
"goss --gossfile /tmp/goss-linux.yaml --loglevel DEBUG validate",
]
}

Expand Down
128 changes: 110 additions & 18 deletions goss/goss-linux.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
command:
asdf:
exec: asdf version
Expand All @@ -9,16 +10,16 @@ command:
exit-status: 0
stdout:
- 2.13.35
azurecli:
exec: az --version
exit-status: 0
stdout:
- 2.54.0
azcopy:
exec: azcopy --version
exit-status: 0
stdout:
- 10.21.2
azurecli:
exec: az --version
exit-status: 0
stdout:
- 2.54.0
bundle:
exec: bundle -v
exit-status: 0
Expand Down Expand Up @@ -61,11 +62,21 @@ command:
exit-status: 0
stdout:
- 2.42.0
jdk8:
exec: /opt/jdk-8/bin/java -version
git_lfs:
exec: git-lfs --version
exit-status: 0
stderr:
- 1.8.0_392
stdout:
- 3.4.0
goss:
exec: goss --version
exit-status: 0
stdout:
- 0.4.4
hadolint:
exec: hadolint -v
exit-status: 0
stdout:
- 2.12.0
jdk11:
exec: /opt/jdk-11/bin/java --version
exit-status: 0
Expand All @@ -81,29 +92,110 @@ command:
exit-status: 0
stdout:
- 21.0.1+12
trivy:
exec: trivy --version
jdk8:
exec: /opt/jdk-8/bin/java -version
exit-status: 0
stderr:
- 1.8.0_392
jq:
exec: jq --version
exit-status: 0
stdout:
- 0.47.0
npm:
exec: npm version
- jq-1.6
jx-release-version:
exec: jx-release-version -version
exit-status: 0
stdout:
- 2.7.0
kubectl:
exec: kubectl version --client
exit-status: 0
stdout:
- 1.23.13
launchable:
exec: launchable --version
exit-status: 0
stdout:
- 1.66.0
make:
exec: make --version
exit-status: 0
maven:
exec: mvn -v
exit-status: 0
stdout:
- 3.9.5
netlify-deploy:
exec: netlify-deploy --help
exit-status: 0
nodejs:
exec: node --version
exit-status: 0
stdout:
- 18.18.2
npm:
exec: npm version
exit-status: 0
packer:
exec: packer -v
exit-status: 0
stdout:
- 1.9.4
parallel:
exec: parallel --version
exit-status: 0
playwright_version:
exec: playwright --version
exit-status: 0
stdout:
- 1.39.0
python3:
exec: python3 --version
exit-status: 0
stdout:
- 3.10.12
ruby:
exec: ruby -v
exit-status: 0
stdout:
- 2.6.10
ssh_agent:
exec: command -v ssh-agent
exit-status: 0
terraform:
exec: terraform -v
exit-status: 0
stdout:
- 1.6.3
trivy:
exec: trivy --version
exit-status: 0
stdout:
- 0.47.0
unzip:
exec: unzip -v
exit-status: 0
updatecli:
exec: updatecli version
exit-status: 0
stderr:
- 0.66.1
vagrant:
exec: vagrant -v
exit-status: 0
yq:
exec: yq --version
exit-status: 0
stdout:
- 4.25.3
zip:
exec: zip -v
exit-status: 0
file:
/home/jenkins:
contains: []
exists: true
mode: "0750"
owner: jenkins
group: jenkins
filetype: directory
contains: []
group: jenkins
mode: '0750'
owner: jenkins
61 changes: 3 additions & 58 deletions provisioning/ubuntu-provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -615,63 +615,6 @@ function cleanup() {
sync
}

function sanity_check() {
echo "== Sanity Check of installed tools, running as user ${username}"
su - "${username}" -c "source ${asdf_install_dir}/asdf.sh \
&& echo 'git-lfs version:' \
&& git-lfs --version \
&& echo 'goss version:' \
&& goss --version \
&& echo 'hadolint version:' \
&& hadolint -v \
&& echo 'java version:' \
&& java -version \
&& echo 'jq version:' \
&& jq --version \
&& echo 'jx-release-version version:' \
&& jx-release-version -version \
&& echo 'kubectl version:' \
&& kubectl version --client \
&& echo 'make version:' \
&& make --version \
&& echo 'maven version:' \
&& mvn -v \
&& echo 'netlify-deploy version:' \
&& netlify-deploy --help \
&& echo 'ssh-agent version:' \
&& command -v ssh-agent \
&& echo 'packer version:' \
&& packer -v \
&& echo 'parallel version:' \
&& parallel --version \
&& echo 'python3 version:' \
&& python3 --version \
&& echo 'ruby version:' \
&& ruby -v \
&& echo 'terraform version:' \
&& terraform -v \
&& echo 'unzip version:' \
&& unzip -v \
&& echo 'updatecli version:' \
&& updatecli version \
&& echo 'vagrant version:' \
&& vagrant -v \
&& echo 'yq version:' \
&& yq --version \
&& echo 'zip version:' \
&& zip -v \
&& echo 'npm version:' \
&& npm --version \
&& echo 'playwright version:' \
&& playwright --version \
&& echo 'launchable version:' \
&& launchable --version
"
echo "== End of sanity check"
echo "== Installed packages:"
dpkg -l
}

function main() {
check_commands
copy_custom_scripts
Expand Down Expand Up @@ -711,8 +654,10 @@ function main() {
install_nodejs
install_playwright
install_launchable

echo "== Installed packages:"
dpkg -l
}

main
sanity_check
cleanup

0 comments on commit bfb779d

Please sign in to comment.