Skip to content

Commit 8715428

Browse files
committed
feat(#184): migrate azure flavour to use azurelinux3.0
1 parent c8347fc commit 8715428

4 files changed

Lines changed: 27 additions & 30 deletions

File tree

build.sh

100644100755
Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
11
#!/usr/bin/env bash
22

3-
set -euo pipefail
3+
set -eo pipefail
44

55
# CloudControl build script
66
# Usage:
77
#
8-
# bash build.sh <tag> [<flavour>]
8+
# bash build.sh [<tag> [<flavour>]]
99
#
10+
# The flavour can only be specified, if a tag is given.
1011
# If no flavour is specified, all flavours will be built
1112

1213
mv Dockerfile Dockerfile.sav &>/dev/null || true
1314

14-
TAG=latest
15-
if [ -n "$1" ]
15+
TAG=''
16+
if [[ -z $1 ]]
1617
then
18+
TAG='latest'
19+
else
1720
TAG=$1
1821
fi
1922

20-
FLAVOURS=""
21-
if [ -n "$1" ] && [ -z "$2" ] || [ -z "$1" ]
23+
FLAVOURS=''
24+
if [[ $# -ne 2 ]]
2225
then
23-
FLAVOURS=$(find flavour -maxdepth 1 -type d -exec basename {} \; | grep -v flavour | paste -s -d " " -)
26+
FLAVOURS=$(find flavour -maxdepth 1 -type d -exec basename {} \; | grep -v flavour | paste -s -d ' ' -)
2427
else
2528
FLAVOURS=$2
2629
fi
@@ -29,7 +32,7 @@ for FLAVOUR in ${FLAVOURS}
2932
do
3033
cat build/Dockerfile.prefix > Dockerfile
3134
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
35+
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
3336
docker build --pull . --no-cache -t "ghcr.io/dodevops/cloudcontrol-${FLAVOUR}:${TAG}"
3437
done
3538

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: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
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 yum
6+
ln -s /usr/bin/tdnf /usr/bin/yum
7+
tdnf install --assumeyes sudo curl tar unzip
8+
for TOOL in 'yum *' 'tdnf *' 'az *' 'chmod *' 'cp *' 'update-ca-trust' 'curl *'
9+
do
10+
echo "cloudcontrol ALL=(root)NOPASSWD:/usr/bin/${TOOL}" >> /etc/sudoers.d/cloudcontrol
11+
done
12+
adduser -mr cloudcontrol
13+
mkdir /home/cloudcontrol/bin
1114
chown cloudcontrol /home/cloudcontrol/bin
15+
RUN_SCRIPT
1216

1317
# Flavour
14-
1518
COPY flavour/azure/flavour /home/cloudcontrol/flavour
1619
COPY flavour/azure/flavourinit.sh /home/cloudcontrol/bin/flavourinit.sh
1720
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)