From d46183ff99ebe4c6212027d57b7525535bfb4c13 Mon Sep 17 00:00:00 2001 From: Shawn Wilsher <656602+sdwilsh@users.noreply.github.com> Date: Mon, 30 Oct 2023 17:06:44 -0700 Subject: [PATCH 1/3] Support GPG Signing of Commits We need to setup sharing of GPG keys for this to work. https://code.visualstudio.com/remote/advancedcontainers/sharing-git-credentials#_sharing-gpg-keys --- devcontainer/features/src/ansible/install.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/devcontainer/features/src/ansible/install.sh b/devcontainer/features/src/ansible/install.sh index b18f0bed..cb794379 100755 --- a/devcontainer/features/src/ansible/install.sh +++ b/devcontainer/features/src/ansible/install.sh @@ -1,11 +1,11 @@ #!/bin/sh set -e +packages="gnupg2" if [ -f requirements.txt ]; then # Install pip to install ansible & kubernetes modules if ! command -v pip; then - sudo apt update - sudo apt install -y --no-install-recommends python3-pip + packages="$packages python3-pip" else echo "Pip already installed" fi @@ -23,6 +23,8 @@ fi # sshpass for initial node provisioning if ! command -v sshpass; then - sudo apt update - sudo apt install -y --no-install-recommends sshpass -fi \ No newline at end of file + packages="$packages sshpass" +fi + +sudo apt update +sudo apt install -y --no-install-recommends "$packages" From c13c8e913d646698c40c6a0d09c407883279e5dc Mon Sep 17 00:00:00 2001 From: Shawn Wilsher <656602+sdwilsh@users.noreply.github.com> Date: Mon, 30 Oct 2023 17:20:15 -0700 Subject: [PATCH 2/3] restructure into two phases --- devcontainer/features/src/ansible/install.sh | 31 +++++++++++++------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/devcontainer/features/src/ansible/install.sh b/devcontainer/features/src/ansible/install.sh index cb794379..b3a2cde1 100755 --- a/devcontainer/features/src/ansible/install.sh +++ b/devcontainer/features/src/ansible/install.sh @@ -1,14 +1,33 @@ #!/bin/sh set -e +# +# Gather & Install Required Packages +# + +# This will contain all the packages we need to install; space seperated. packages="gnupg2" + if [ -f requirements.txt ]; then # Install pip to install ansible & kubernetes modules if ! command -v pip; then packages="$packages python3-pip" - else - echo "Pip already installed" fi +fi + +# sshpass for initial node provisioning +if ! command -v sshpass; then + packages="$packages sshpass" +fi + +sudo apt update +sudo apt install -y --no-install-recommends "$packages" + +# +# Non-Package Requirements +# + +if [ -f requirements.txt ]; then pip install -r requirements.txt else echo "No requirements.txt found" @@ -20,11 +39,3 @@ if [ -f requirements.yml ]; then else echo "No requirements.yml found" fi - -# sshpass for initial node provisioning -if ! command -v sshpass; then - packages="$packages sshpass" -fi - -sudo apt update -sudo apt install -y --no-install-recommends "$packages" From 7c8537893443ca0bc9b5c1fd3ac17ee660954203 Mon Sep 17 00:00:00 2001 From: Shawn Wilsher <656602+sdwilsh@users.noreply.github.com> Date: Mon, 30 Oct 2023 17:55:45 -0700 Subject: [PATCH 3/3] do not double quote because we need expansion --- devcontainer/features/src/ansible/install.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/devcontainer/features/src/ansible/install.sh b/devcontainer/features/src/ansible/install.sh index b3a2cde1..f728261a 100755 --- a/devcontainer/features/src/ansible/install.sh +++ b/devcontainer/features/src/ansible/install.sh @@ -1,5 +1,7 @@ #!/bin/sh set -e +# Disable Globbing +set -f # # Gather & Install Required Packages @@ -20,8 +22,9 @@ if ! command -v sshpass; then packages="$packages sshpass" fi -sudo apt update -sudo apt install -y --no-install-recommends "$packages" +sudo apt-get update +# shellcheck disable=SC2086 +sudo apt-get install -y --no-install-recommends $packages # # Non-Package Requirements