Skip to content
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,10 @@ initialization process does.

#### Configuration

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

### <a id="gcloud"></a> gcloud
Expand Down
28 changes: 16 additions & 12 deletions build.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,35 @@ set -euo pipefail
# CloudControl build script
# Usage:
#
# bash build.sh <tag> [<flavour>]
# bash build.sh [<tag> [<flavour>]]
#
# If no tag is given, latest will be used
# The flavour can only be specified, if a tag is given.
# If no flavour is specified, all flavours will be built

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

TAG=latest
if [ -n "$1" ]
TAG="${1-latest}"
EXISTING_FLAVOURS=$(find flavour -mindepth 1 -maxdepth 1 -type d -exec basename {} \; | paste -s -d ' ' -)" "
FLAVOURS=''
if [[ $# -ne 2 ]]
then
TAG=$1
fi

FLAVOURS=""
if [ -n "$1" ] && [ -z "$2" ] || [ -z "$1" ]
then
FLAVOURS=$(find flavour -maxdepth 1 -type d -exec basename {} \; | grep -v flavour | paste -s -d " " -)
FLAVOURS=${EXISTING_FLAVOURS}
else
FLAVOURS=$2
if [[ "${EXISTING_FLAVOURS}" == *"$2 "* ]]
then
FLAVOURS=$2
else
>&2 echo "The flavour '$2' does not exist!"
exit 1
fi
fi

for FLAVOUR in ${FLAVOURS}
do
cat build/Dockerfile.prefix > Dockerfile
cat "flavour/${FLAVOUR}/Dockerfile.flavour" >> Dockerfile
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
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
docker build --pull . --no-cache -t "ghcr.io/dodevops/cloudcontrol-${FLAVOUR}:${TAG}"
done

Expand Down
11 changes: 1 addition & 10 deletions feature/_fish/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,7 @@
if [[ "${FLAVOUR}" =~ (simple|tanzu|gcloud) ]]
then
execHandle 'Installing fish' sudo apk add fish perl fzf git
elif [[ "${FLAVOUR}" == "azure" ]]
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" ]]
elif [[ "${FLAVOUR}" =~ (aws|azure) ]]
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
Expand Down
22 changes: 12 additions & 10 deletions flavour/azure/Dockerfile.flavour
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
FROM mcr.microsoft.com/azure-cli:cbl-mariner2.0
FROM mcr.microsoft.com/azure-cli:azurelinux3.0

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 && \

RUN <<RUN_SCRIPT
ln -s /usr/bin/tdnf /usr/bin/yum
tdnf install --assumeyes sudo curl tar unzip
for TOOL in 'yum *' 'tdnf *' 'az *' 'chmod *' 'cp *' 'update-ca-trust' 'curl *'
do
echo "cloudcontrol ALL=(root)NOPASSWD:/usr/bin/${TOOL}" >> /etc/sudoers.d/cloudcontrol
done
adduser -mr cloudcontrol
mkdir /home/cloudcontrol/bin
chown cloudcontrol /home/cloudcontrol/bin
RUN_SCRIPT

# Flavour

COPY flavour/azure/flavour /home/cloudcontrol/flavour
COPY flavour/azure/flavourinit.sh /home/cloudcontrol/bin/flavourinit.sh
RUN chmod +x /home/cloudcontrol/bin/flavourinit.sh
4 changes: 2 additions & 2 deletions flavour/azure/flavour.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ description: |
(located in ~/bin, thus available without path) to re-execute the same login commands as the
initialization process does.
configuration:
- "Environment AZ_SUBSCRIPTION: The Azure subscription to use in this container (deprecated)"
- "Environment ARM_SUBSCRIPTION_ID: The Azure subscription to use in this container"
- "Environment AZ_TENANTID: The Azure tenant id to log into (optional, deprecated)"
- "Environment ARM_TENANT_ID: The Azure tenant id to log into (optional)"
- "Environment AZ_SUBSCRIPTION: The Azure subscription to use in this container (deprecated)"
- "Environment AZ_TENANTID: The Azure tenant id to log into (optional, deprecated)"
- "Environment AZ_USE_ARM_SPI: Uses the environment variables ARM_CLIENT_ID and ARM_CLIENT_SECRET for service principal auth [false]"
platforms:
- linux/amd64
Expand Down
Loading