Skip to content

Commit 65ab10a

Browse files
ThomasMinorDO! DevOps bot
andauthored
feat: Use azurelinux 3.0 for the azure Image (#185)
* feat: migrate azure flavour to use azurelinux3.0 #184 * docs: Automatic docs update --------- Co-authored-by: DO! DevOps bot <info@dodevops.io>
1 parent c8347fc commit 65ab10a

5 files changed

Lines changed: 33 additions & 36 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,10 @@ initialization process does.
342342

343343
#### Configuration
344344

345-
* Environment AZ_SUBSCRIPTION: The Azure subscription to use in this container (deprecated)
346345
* Environment ARM_SUBSCRIPTION_ID: The Azure subscription to use in this container
347-
* Environment AZ_TENANTID: The Azure tenant id to log into (optional, deprecated)
348346
* Environment ARM_TENANT_ID: The Azure tenant id to log into (optional)
347+
* Environment AZ_SUBSCRIPTION: The Azure subscription to use in this container (deprecated)
348+
* Environment AZ_TENANTID: The Azure tenant id to log into (optional, deprecated)
349349
* Environment AZ_USE_ARM_SPI: Uses the environment variables ARM_CLIENT_ID and ARM_CLIENT_SECRET for service principal auth [false]
350350

351351
### <a id="gcloud"></a> gcloud

build.sh

100644100755
Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,35 @@ set -euo pipefail
55
# CloudControl build script
66
# Usage:
77
#
8-
# bash build.sh <tag> [<flavour>]
8+
# bash build.sh [<tag> [<flavour>]]
99
#
10+
# If no tag is given, latest will be used
11+
# The flavour can only be specified, if a tag is given.
1012
# If no flavour is specified, all flavours will be built
1113

1214
mv Dockerfile Dockerfile.sav &>/dev/null || true
1315

14-
TAG=latest
15-
if [ -n "$1" ]
16+
TAG="${1-latest}"
17+
EXISTING_FLAVOURS=$(find flavour -mindepth 1 -maxdepth 1 -type d -exec basename {} \; | paste -s -d ' ' -)" "
18+
FLAVOURS=''
19+
if [[ $# -ne 2 ]]
1620
then
17-
TAG=$1
18-
fi
19-
20-
FLAVOURS=""
21-
if [ -n "$1" ] && [ -z "$2" ] || [ -z "$1" ]
22-
then
23-
FLAVOURS=$(find flavour -maxdepth 1 -type d -exec basename {} \; | grep -v flavour | paste -s -d " " -)
21+
FLAVOURS=${EXISTING_FLAVOURS}
2422
else
25-
FLAVOURS=$2
23+
if [[ "${EXISTING_FLAVOURS}" == *"$2 "* ]]
24+
then
25+
FLAVOURS=$2
26+
else
27+
>&2 echo "The flavour '$2' does not exist!"
28+
exit 1
29+
fi
2630
fi
2731

2832
for FLAVOUR in ${FLAVOURS}
2933
do
3034
cat build/Dockerfile.prefix > Dockerfile
3135
cat "flavour/${FLAVOUR}/Dockerfile.flavour" >> Dockerfile
32-
cat build/Dockerfile.suffix.mo | docker run --rm -i -e FLAVOUR=${FLAVOUR} -e BUILD_DATE=$(date -Iseconds) ghcr.io/tests-always-included/mo:3.0.5 >> Dockerfile
36+
cat build/Dockerfile.suffix.mo | docker run --rm -i -e FLAVOUR=${FLAVOUR} -e BUILD_DATE="$(date -Iseconds)" ghcr.io/tests-always-included/mo:3.0.5 >> Dockerfile
3337
docker build --pull . --no-cache -t "ghcr.io/dodevops/cloudcontrol-${FLAVOUR}:${TAG}"
3438
done
3539

feature/_fish/install.sh

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,7 @@
33
if [[ "${FLAVOUR}" =~ (simple|tanzu|gcloud) ]]
44
then
55
execHandle 'Installing fish' sudo apk add fish perl fzf git
6-
elif [[ "${FLAVOUR}" == "azure" ]]
7-
then
8-
prepare
9-
execHandle 'Installing fish' sudo yum install -y fish perl git
10-
execHandle 'Downloading fzf' curl -f -s -L https://github.com/junegunn/fzf/archive/master.zip -o master.zip
11-
execHandle 'Unzipping fzf' unzip master.zip
12-
execHandle 'Moving fzf' mv fzf-master ~/bin
13-
execHandle 'Installing fzf' ~/bin/fzf-master/install --all
14-
cleanup
15-
elif [[ "${FLAVOUR}" == "aws" ]]
6+
elif [[ "${FLAVOUR}" =~ (aws|azure) ]]
167
then
178
prepare
189
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

flavour/azure/Dockerfile.flavour

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
FROM mcr.microsoft.com/azure-cli:cbl-mariner2.0
1+
FROM mcr.microsoft.com/azure-cli:azurelinux3.0
22

3-
RUN yum install -y sudo curl tar unzip && \
4-
echo "cloudcontrol ALL=(root)NOPASSWD:/usr/bin/yum *" > /etc/sudoers.d/cloudcontrol && \
5-
echo "cloudcontrol ALL=(root)NOPASSWD:/usr/bin/az *" >> /etc/sudoers.d/cloudcontrol && \
6-
echo "cloudcontrol ALL=(root)NOPASSWD:/usr/bin/chmod *" >> /etc/sudoers.d/cloudcontrol && \
7-
echo "cloudcontrol ALL=(root)NOPASSWD:/usr/bin/cp *" >> /etc/sudoers.d/cloudcontrol && \
8-
echo "cloudcontrol ALL=(root)NOPASSWD:/usr/bin/update-ca-trust" >> /etc/sudoers.d/cloudcontrol && \
9-
adduser -mr cloudcontrol && \
10-
mkdir /home/cloudcontrol/bin && \
3+
4+
RUN <<RUN_SCRIPT
5+
ln -s /usr/bin/tdnf /usr/bin/yum
6+
tdnf install --assumeyes sudo curl tar unzip
7+
for TOOL in 'yum *' 'tdnf *' 'az *' 'chmod *' 'cp *' 'update-ca-trust' 'curl *'
8+
do
9+
echo "cloudcontrol ALL=(root)NOPASSWD:/usr/bin/${TOOL}" >> /etc/sudoers.d/cloudcontrol
10+
done
11+
adduser -mr cloudcontrol
12+
mkdir /home/cloudcontrol/bin
1113
chown cloudcontrol /home/cloudcontrol/bin
14+
RUN_SCRIPT
1215

1316
# Flavour
14-
1517
COPY flavour/azure/flavour /home/cloudcontrol/flavour
1618
COPY flavour/azure/flavourinit.sh /home/cloudcontrol/bin/flavourinit.sh
1719
RUN chmod +x /home/cloudcontrol/bin/flavourinit.sh

flavour/azure/flavour.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ description: |
77
(located in ~/bin, thus available without path) to re-execute the same login commands as the
88
initialization process does.
99
configuration:
10-
- "Environment AZ_SUBSCRIPTION: The Azure subscription to use in this container (deprecated)"
1110
- "Environment ARM_SUBSCRIPTION_ID: The Azure subscription to use in this container"
12-
- "Environment AZ_TENANTID: The Azure tenant id to log into (optional, deprecated)"
1311
- "Environment ARM_TENANT_ID: The Azure tenant id to log into (optional)"
12+
- "Environment AZ_SUBSCRIPTION: The Azure subscription to use in this container (deprecated)"
13+
- "Environment AZ_TENANTID: The Azure tenant id to log into (optional, deprecated)"
1414
- "Environment AZ_USE_ARM_SPI: Uses the environment variables ARM_CLIENT_ID and ARM_CLIENT_SECRET for service principal auth [false]"
1515
platforms:
1616
- linux/amd64

0 commit comments

Comments
 (0)