Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Switches to new Azure image #167

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion feature/_fish/goss/goss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ command:
stdout:
- fish, version
fzf:
{{ if eq .Env.FLAVOUR "aws" -}}
{{ if or (eq .Env.FLAVOUR "aws") (eq .Env.FLAVOUR "azure") -}}
exec: "/home/cloudcontrol/bin/fzf-master/bin/fzf --version"
{{ else -}}
exec: "/usr/bin/fzf --version"
Expand Down
22 changes: 13 additions & 9 deletions feature/_fish/install.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
. /feature-installer-utils.sh

FLAVOUR="X$(cat /home/cloudcontrol/flavour)X"
if [[ "X${FLAVOUR}X" =~ X(azure|simple|tanzu|gcloud)X ]]
if [[ "${FLAVOUR}" =~ (simple|tanzu|gcloud) ]]
then
echo "Installing packages"
execHandle 'Installing fish' sudo apk add fish perl fzf git
elif [ "${FLAVOUR}" == "XawsX" ]
elif [[ "${FLAVOUR}" == "azure" ]]
dploeger marked this conversation as resolved.
Show resolved Hide resolved
then
prepare
execHandle 'Installing fish' sudo yum install -y fish perl git
execHandle 'Downloading fzf' curl -f -s -L https://github.com/junegunn/fzf/archive/master.zip -o master.zip
execHandle 'Unzipping fzf' unzip master.zip
execHandle 'Moving fzf' mv fzf-master ~/bin
execHandle 'Installing fzf' ~/bin/fzf-master/install --all
cleanup
elif [[ "${FLAVOUR}" == "aws" ]]
then
prepare
execHandle 'Downloading fish repo' sudo curl -f -s -L https://download.opensuse.org/repositories/shells:fish:release:3/CentOS_7/shells:fish:release:3.repo -o /etc/yum.repos.d/shells:fish:release:3.repo
execHandle 'Installing fish' sudo yum install -y fish git

TEMPDIR=$(mktemp -d)
cd "${TEMPDIR}" || exit
execHandle 'Downloading fzf' curl -f -s -L https://github.com/junegunn/fzf/archive/master.zip -o master.zip
execHandle 'Unzipping fzf' unzip master.zip
execHandle 'Moving fzf' mv fzf-master ~/bin
execHandle 'Installing fzf' ~/bin/fzf-master/install --all
cd - &>/dev/null || exit
rm -rf "${TEMPDIR}"
cleanup
fi

execHandle 'Installing fisher' fish -c 'curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher'
Expand Down
8 changes: 4 additions & 4 deletions feature/ca-certificates/goss/goss.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
file:
{{if eq .Env.FLAVOUR "aws" }}
{{if or (eq .Env.FLAVOUR "aws") (eq .Env.FLAVOUR "azure") }}
/etc/pki/ca-trust/source/anchors/testcert.pem:
{{else if ne .Env.FLAVOUR "aws" }}
{{else}}
/usr/local/share/ca-certificates/testcert.pem:
{{end}}
exists: true
{{if eq .Env.FLAVOUR "aws" }}
{{if or (eq .Env.FLAVOUR "aws") (eq .Env.FLAVOUR "azure") }}
/etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt:
exists: true
contains:
- Bogus Broccoli X2
{{else if ne .Env.FLAVOUR "aws" }}
{{else}}
/etc/ssl/certs/ca-certificates.crt:
exists: true
contains:
Expand Down
4 changes: 2 additions & 2 deletions feature/ca-certificates/install.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
. /feature-installer-utils.sh

if [[ "${FLAVOUR}" =~ (azure|simple|tanzu|gcloud) ]]
if [[ "${FLAVOUR}" =~ (simple|tanzu|gcloud) ]]
then
execHandle "Copying certificates to the OS target location" sudo cp "${CERTIFICATES_PATH:=/certificates}"/*.pem /usr/local/share/ca-certificates/
execHandle "Updating certificate bundle" sudo su - -c "cat /usr/local/share/ca-certificates/*.pem >> /etc/ssl/certs/ca-certificates.crt"
elif [[ "${FLAVOUR}" == "aws" ]]
elif [[ "${FLAVOUR}" =~ (aws|azure) ]]
then
execHandle "Copying certificates to the OS target location" sudo cp "${CERTIFICATES_PATH:=/certificates}"/*.pem /etc/pki/ca-trust/source/anchors/
execHandle "Updating certificate bundle" sudo /usr/bin/update-ca-trust
Expand Down
3 changes: 1 addition & 2 deletions feature/certificates/goss/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
CERTIFICATES_PATH=/goss-sup
DEBUG_CCC=yes
CERTIFICATES_PATH=/goss-sup
8 changes: 4 additions & 4 deletions feature/certificates/goss/goss.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
file:
{{if eq .Env.FLAVOUR "aws" }}
{{if or (eq .Env.FLAVOUR "aws") (eq .Env.FLAVOUR "azure") }}
/etc/pki/ca-trust/source/anchors/testcert.pem:
{{else if ne .Env.FLAVOUR "aws" }}
{{else}}
/usr/local/share/ca-certificates/testcert.pem:
{{end}}
exists: true
{{if eq .Env.FLAVOUR "aws" }}
{{if or (eq .Env.FLAVOUR "aws") (eq .Env.FLAVOUR "azure") }}
/etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt:
exists: true
contains:
- Bogus Broccoli X2
{{else if ne .Env.FLAVOUR "aws" }}
{{else}}
/etc/ssl/certs/ca-certificates.crt:
exists: true
contains:
Expand Down
5 changes: 2 additions & 3 deletions feature/certificates/install.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
. /feature-installer-utils.sh

FLAVOUR="X$(cat /home/cloudcontrol/flavour)X"
if [[ "X${FLAVOUR}X" =~ X(azure|simple|tanzu|gcloud)X ]]
if [[ "${FLAVOUR}" =~ (simple|tanzu|gcloud) ]]
then
execHandle "Copying certificates to the OS target location" sudo cp "${CERTIFICATES_PATH:=/certificates}"/*.pem /usr/local/share/ca-certificates/
execHandle "Updating certificate bundle" sudo su - -c "cat /usr/local/share/ca-certificates/*.pem >> /etc/ssl/certs/ca-certificates.crt"
elif [ "${FLAVOUR}" == "XawsX" ]
elif [[ "${FLAVOUR}" =~ (aws|azure) ]]
then
execHandle "Copying certificates to the OS target location" sudo cp "${CERTIFICATES_PATH:=/certificates}"/*.pem /etc/pki/ca-trust/source/anchors/
execHandle "Updating certificate bundle" sudo /usr/bin/update-ca-trust
Expand Down
4 changes: 2 additions & 2 deletions feature/jq/install.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
. /feature-installer-utils.sh

FLAVOUR="X$(cat /home/cloudcontrol/flavour)X"
if [[ "X${FLAVOUR}X" =~ X(azure|simple|tanzu|gcloud)X ]]
if [[ "${FLAVOUR}" =~ (simple|tanzu|gcloud) ]]
then
execHandle "Installing jq" sudo apk add jq
elif [ "${FLAVOUR}" == "XawsX" ]
elif [[ "${FLAVOUR}" =~ (azure|aws) ]]
then
execHandle "Installing jq" sudo yum install -y jq
fi
4 changes: 2 additions & 2 deletions feature/kc/install.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
. /feature-installer-utils.sh

FLAVOUR="X$(cat /home/cloudcontrol/flavour)X"
if [[ "X${FLAVOUR}X" =~ X(azure|simple|tanzu|gcloud)X ]]
if [[ "${FLAVOUR}" =~ (simple|tanzu|gcloud) ]]
then
execHandle "Installing dialog package" sudo apk add dialog
elif [ "${FLAVOUR}" == "XawsX" ]
elif [[ "${FLAVOUR}" =~ (aws|azure) ]]
then
execHandle "Installing dialog package" sudo yum install -y dialog
fi
Expand Down
4 changes: 2 additions & 2 deletions feature/krew/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ else
fi

FLAVOUR="X$(cat /home/cloudcontrol/flavour)X"
if [[ "X${FLAVOUR}X" =~ X(azure|simple|tanzu|gcloud)X ]]
if [[ "${FLAVOUR}" =~ (simple|tanzu|gcloud) ]]
then
execHandle 'Installing git' sudo apk add git
elif [ "${FLAVOUR}" == "XawsX" ]
elif [[ "${FLAVOUR}" =~ (aws|azure) ]]
then
execHandle 'Installing git' sudo yum install -y git
fi
Expand Down
4 changes: 2 additions & 2 deletions feature/packages/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
IFS=' ' read -r -a packages_array <<< "${PACKAGES}"

FLAVOUR="X$(cat /home/cloudcontrol/flavour)X"
if [[ "X${FLAVOUR}X" =~ X(azure|simple|tanzu|gcloud)X ]]
if [[ "${FLAVOUR}" =~ (simple|tanzu|gcloud) ]]
then
execHandle "Installing packages" sudo apk add "${packages_array[@]}"
elif [ "${FLAVOUR}" == "XawsX" ]
elif [[ "${FLAVOUR}" =~ (aws|azure) ]]
then
execHandle "Installing packages" sudo yum install -y "${packages_array[@]}"
fi
2 changes: 2 additions & 0 deletions feature/timezone/goss/.env.azure
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
USE_packages=yes
PACKAGES=diffutils
6 changes: 4 additions & 2 deletions feature/timezone/install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
. /feature-installer-utils.sh

FLAVOUR="X$(cat /home/cloudcontrol/flavour)X"
if [[ "X${FLAVOUR}X" =~ X(azure|simple|tanzu|gcloud)X ]]
if [[ "${FLAVOUR}" =~ (simple|tanzu|gcloud) ]]
then
execHandle "Installing tzdata package" sudo apk add tzdata
elif [[ "${FLAVOUR}" =~ (azure) ]]
then
execHandle "Installing tzdata package" sudo yum install -y tzdata
fi
5 changes: 2 additions & 3 deletions feature/vim/install.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
. /feature-installer-utils.sh

FLAVOUR="X$(cat /home/cloudcontrol/flavour)X"
if [[ "X${FLAVOUR}X" =~ X(azure|simple|tanzu|gcloud)X ]]
if [[ "${FLAVOUR}" =~ (simple|tanzu|gcloud) ]]
then
execHandle "Installing vim" sudo apk add vim
elif [ "${FLAVOUR}" == "XawsX" ]
elif [[ "${FLAVOUR}" =~ (aws|azure) ]]
then
execHandle "Installing vim" sudo yum install -y vim
fi
16 changes: 8 additions & 8 deletions flavour/azure/Dockerfile.flavour
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM mcr.microsoft.com/azure-cli:2.63.0
FROM mcr.microsoft.com/azure-cli:cbl-mariner2.0

RUN apk add sudo bash curl && \
echo "cloudcontrol ALL=(root)NOPASSWD:/sbin/apk *" > /etc/sudoers.d/cloudcontrol && \
echo "cloudcontrol ALL=(root)NOPASSWD:/usr/local/bin/az *" >> /etc/sudoers.d/cloudcontrol && \
echo "cloudcontrol ALL=(root)NOPASSWD:/bin/chmod *" >> /etc/sudoers.d/cloudcontrol && \
echo "cloudcontrol ALL=(root)NOPASSWD:/bin/cp *" >> /etc/sudoers.d/cloudcontrol && \
echo "cloudcontrol ALL=(root)NOPASSWD:/bin/su - -c cat /usr/local/share/ca-certificates/*.pem >> /etc/ssl/certs/ca-certificates.crt" >> /etc/sudoers.d/cloudcontrol && \
adduser -D cloudcontrol && \
RUN yum install -y sudo curl tar unzip && \
echo "cloudcontrol ALL=(root)NOPASSWD:/usr/bin/yum *" > /etc/sudoers.d/cloudcontrol && \
echo "cloudcontrol ALL=(root)NOPASSWD:/usr/bin/az *" >> /etc/sudoers.d/cloudcontrol && \
echo "cloudcontrol ALL=(root)NOPASSWD:/usr/bin/chmod *" >> /etc/sudoers.d/cloudcontrol && \
echo "cloudcontrol ALL=(root)NOPASSWD:/usr/bin/cp *" >> /etc/sudoers.d/cloudcontrol && \
echo "cloudcontrol ALL=(root)NOPASSWD:/usr/bin/update-ca-trust" >> /etc/sudoers.d/cloudcontrol && \
adduser -mr cloudcontrol && \
mkdir /home/cloudcontrol/bin && \
chown cloudcontrol /home/cloudcontrol/bin

Expand Down
Loading