diff --git a/.octopus/ubuntu.multi.arch/deployment_process.ocl b/.octopus/ubuntu.multi.arch/deployment_process.ocl new file mode 100644 index 0000000..6540df5 --- /dev/null +++ b/.octopus/ubuntu.multi.arch/deployment_process.ocl @@ -0,0 +1,97 @@ +step "push-docker-image" { + name = "Push Docker image" + + action { + environments = ["staging", "production"] + is_disabled = true + properties = { + DockerPush.Target.Docker.Registry.Hostname = "#{Docker.Registry.Target.Hostname}" + DockerPush.Target.Docker.Registry.Password = "#{Docker.Registry.Target.Password}" + DockerPush.Target.Docker.Registry.Username = "#{Docker.Registry.Target.Username}" + DockerPush.Target.Docker.Repository = "#{Docker.Registry.Target.Repository}" + Octopus.Action.Template.Id = "ActionTemplates-2141" + Octopus.Action.Template.Version = "12" + OctopusUseBundledTooling = "False" + } + worker_pool = "hosted-ubuntu" + + container { + feed = "docker-packages-octopushq" + image = "octopusdeploy/tool-containers/tool-skopeo-cli" + } + } +} + +step "tag-and-re-push-docker-image" { + name = "Tag and Re-push Docker Image" + + action { + action_type = "Octopus.Script" + environments = ["staging", "production"] + properties = { + Octopus.Action.Script.ScriptBody = <<-EOT + #!/bin/bash + echo "##octopus[stderr-progress]" + set -eux + + sourceHostName=$(get_octopusvariable "OctopusDockerRegistry.Hostname") + targetHostName=$(get_octopusvariable "Docker.Registry.Target.Hostname") + + echo "Source Registry Name: $sourceHostName" + echo "Target Registry Name: $targetHostName" + + retry --times=3 --delay=5 -- skopeo login -u $(get_octopusvariable "OctopusDockerRegistry.Username") -p $(get_octopusvariable "OctopusDockerRegistry.Password") $sourceHostName + retry --times=3 --delay=5 -- skopeo login -u $(get_octopusvariable "Docker.Registry.Target.Username") -p $(get_octopusvariable "Docker.Registry.Target.Password") $targetHostName + + repositoryTagsJson=$(retry --times=3 --delay=5 -- skopeo list-tags docker://$(get_octopusvariable "OctopusDockerRegistry.WorkerTools.Repository")) + + # Up to here + osSuffix=$(get_octopusvariable "WorkerTools.Tags.Os") + fullyQualifiedTag=$(get_octopusvariable "WorkerTools.Version.Full")-${osSuffix} + + semVerRegex="[0-9]+\.[0-9]+\.[0-9]+\-.*" + if ! [[ $fullyQualifiedTag =~ $semVerRegex ]]; then + echo "The tag $fullyQualifiedTag should be a fully qualified SemVer tag" + exit 1 + fi + + matchingSourceTag=$(jq -r --arg fullyQualifiedTag "$fullyQualifiedTag" '.Tags[] | select(.==$fullyQualifiedTag)' <<<"$repositoryTagsJson") + + if [ "$fullyQualifiedTag" != "$matchingSourceTag" ]; then + echo "The tag $fullyQualifiedTag could not be found in $sourceHostName" + exit 1 + fi + + # We apply a pre-release tag for now if pushing to public repo + prereleaseTag=$(get_octopusvariable "WorkerTools.Tags.Prerelease") + latestTag=${osSuffix} + latestMajorTag=$(get_octopusvariable "WorkerTools.Version.Major")-${osSuffix} + latestMinorTag=$(get_octopusvariable "WorkerTools.Version.MajorMinor")-${osSuffix} + + echo "Image tag for promotion: $fullyQualifiedTag" + + if [ "$sourceHostName" != "$targetHostName" ]; then + echo "Pushing $fullyQualifiedTag tag to target registry" + retry --times=6 --delay=10 -- skopeo copy --all docker://$(get_octopusvariable "OctopusDockerRegistry.WorkerTools.Repository"):$fullyQualifiedTag docker://$(get_octopusvariable "Docker.Registry.Target.Repository"):$fullyQualifiedTag + fi + + echo "Pushing floating tags to target registry:" + echo $latestMajorTag + echo $latestMinorTag + echo $latestTag + retry --times=6 --delay=10 -- skopeo copy --all docker://$(get_octopusvariable "OctopusDockerRegistry.WorkerTools.Repository"):$fullyQualifiedTag docker://$(get_octopusvariable "Docker.Registry.Target.Repository"):$latestMajorTag + retry --times=6 --delay=10 -- skopeo copy --all docker://$(get_octopusvariable "OctopusDockerRegistry.WorkerTools.Repository"):$fullyQualifiedTag docker://$(get_octopusvariable "Docker.Registry.Target.Repository"):$latestMinorTag + retry --times=6 --delay=10 -- skopeo copy --all docker://$(get_octopusvariable "OctopusDockerRegistry.WorkerTools.Repository"):$fullyQualifiedTag docker://$(get_octopusvariable "Docker.Registry.Target.Repository"):$latestTag + EOT + Octopus.Action.Script.ScriptSource = "Inline" + Octopus.Action.Script.Syntax = "Bash" + OctopusUseBundledTooling = "False" + } + worker_pool = "hosted-ubuntu" + + container { + feed = "docker-packages-octopushq" + image = "octopusdeploy/tool-containers/tool-skopeo-cli" + } + } +} \ No newline at end of file diff --git a/.octopus/ubuntu.multi.arch/deployment_settings.ocl b/.octopus/ubuntu.multi.arch/deployment_settings.ocl new file mode 100644 index 0000000..562e7dd --- /dev/null +++ b/.octopus/ubuntu.multi.arch/deployment_settings.ocl @@ -0,0 +1,7 @@ +connectivity_policy { + allow_deployments_to_no_targets = true +} + +versioning_strategy { + template = "#{Octopus.Version.LastMajor}.#{Octopus.Version.LastMinor}.#{Octopus.Version.NextPatch}" +} \ No newline at end of file diff --git a/.octopus/ubuntu.multi.arch/schema_version.ocl b/.octopus/ubuntu.multi.arch/schema_version.ocl new file mode 100644 index 0000000..500586e --- /dev/null +++ b/.octopus/ubuntu.multi.arch/schema_version.ocl @@ -0,0 +1 @@ +version = 10 \ No newline at end of file diff --git a/.octopus/ubuntu.multi.arch/variables.ocl b/.octopus/ubuntu.multi.arch/variables.ocl new file mode 100644 index 0000000..5cdcecc --- /dev/null +++ b/.octopus/ubuntu.multi.arch/variables.ocl @@ -0,0 +1,74 @@ +variable "Docker.Registry.Target.Hostname" { + value "#{DockerHubDockerRegistry.Hostname}" { + environment = ["production"] + } + + value "#{OctopusDockerRegistry.Hostname}" { + description = "" + environment = ["staging"] + } +} + +variable "WorkerTools.Version.MajorMinor" { + value "#{Octopus.Release.Number | VersionMajor}.#{Octopus.Release.Number | VersionMinor}" {} +} + +variable "WorkerTools.Version.Major" { + value "#{Octopus.Release.Number | VersionMajor}" {} +} + +variable "WorkerTools.Version.Full" { + value "#{Octopus.Release.Number}" {} +} + +variable "WorkerTools.Tags.Os" { + value "ubuntu.24.04" {} +} + +variable "WorkerTools.Tags.FullyQualified" { + value "#{Octopus.Release.Number}-ubuntu.24.04" {} +} + +variable "Promoter.OsSuffix" { + value "ubuntu.24.04" {} +} + +variable "Docker.Registry.Target.Username" { + value "#{DockerHubDockerRegistry.Username}" { + environment = ["production"] + } + + value "#{OctopusDockerRegistry.Username}" { + environment = ["staging"] + } +} + +variable "Docker.Registry.Target.Repository" { + value "docker.io/octopusdeploy/worker-tools" { + environment = ["production"] + } + + value "docker.packages.octopushq.com/octopusdeploy/worker-tools" { + environment = ["staging"] + } +} + +variable "Docker.Registry.Target.Password" { + value "#{DockerHubDockerRegistry.Password}" { + environment = ["production"] + } + + value "#{OctopusDockerRegistry.Password}" { + environment = ["staging"] + } +} + +variable "WorkerTools.Tags.Prerelease" { + value "-beta" { + environment = ["production"] + } + + value { + environment = ["staging"] + } +} \ No newline at end of file diff --git a/GitVersion.yml b/GitVersion.yml index 2210324..cbd71cc 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1 +1,5 @@ mode: ContinuousDeployment + +branches: + pull-request: + tag: pr- diff --git a/docker-compose.build.yml b/docker-compose.build.yml index 0ef09a7..e71b772 100644 --- a/docker-compose.build.yml +++ b/docker-compose.build.yml @@ -1,5 +1,3 @@ -version: '3' - services: ubuntu.18.04: build: ubuntu.18.04 @@ -16,6 +14,28 @@ services: - ./ubuntu.22.04:/app working_dir: /app entrypoint: ["pwsh", "-file", "scripts/run-tests.ps1"] + + ubuntu.24.04-amd64: + build: + context: ./ubuntu.24.04 + args: + TARGETPLATFORM: linux/amd64 + image: docker.packages.octopushq.com/octopusdeploy/worker-tools:${BUILD_NUMBER?err}-ubuntu.24.04-amd64 + volumes: + - ./ubuntu.24.04:/app + working_dir: /app + entrypoint: ["pwsh", "-file", "scripts/run-tests.ps1"] + + ubuntu.24.04-arm64: + build: + context: ./ubuntu.24.04 + args: + TARGETPLATFORM: linux/arm64 + image: docker.packages.octopushq.com/octopusdeploy/worker-tools:${BUILD_NUMBER?err}-ubuntu.24.04-arm64 + volumes: + - ./ubuntu.24.04:/app + working_dir: /app + entrypoint: ["pwsh", "-file", "scripts/run-tests.ps1"] windows.ltsc2019: build: windows.ltsc2019 @@ -31,4 +51,4 @@ services: volumes: - "./windows.ltsc2022:c:\\app" working_dir: "c:\\app" - entrypoint: ["pwsh", "-file", "scripts/run-tests.ps1"] \ No newline at end of file + entrypoint: ["pwsh", "-file", "scripts/run-tests.ps1"] diff --git a/ubuntu.24.04/Dockerfile b/ubuntu.24.04/Dockerfile new file mode 100644 index 0000000..91eeb9e --- /dev/null +++ b/ubuntu.24.04/Dockerfile @@ -0,0 +1,246 @@ +ARG TARGETPLATFORM=linux/arm64 + +FROM --platform=$TARGETPLATFORM ubuntu:24.04 + +# Redeclare to make available in this build stage +ARG TARGETPLATFORM + +ENV DEBIAN_FRONTEND=noninteractive + +ARG Argocd_Version=2.14.21 +ARG Aws_Cli_Version=2.24.10 +ARG Aws_Iam_Authenticator_Version=0.7.9 +ARG Aws_Powershell_Version=4.1.734 +ARG Azure_Cli_Version=2.67.0-1~noble +ARG Azure_Powershell_Version=13.0.0 +ARG Dotnet_Sdk_Version=8.0 +ARG Ecs_Cli_Version=1.21.0 +ARG Eks_Cli_Version=v0.220.0 +ARG Google_Cloud_Cli_Version=550.0.0-0 +ARG Google_Cloud_Gke_Cloud_Auth_Plugin_Version=550.0.0-0 +ARG Helm_Version=v3.16.4 +ARG Java_Jdk_Version=21 +ARG Kubectl_Version=1.32 +ARG Kubelogin_Version=v0.1.6 +ARG NodeJs_Version=22 +ARG Octopus_Cli_Version=2.20.1 +ARG Octopus_Client_Version=14.3.1789 +ARG Powershell_Version=7.5.4 +ARG Terraform_Version=1.10.4 + +# Install common tools +RUN apt-get update && \ + apt-get install -y --no-install-recommends wget unzip apt-utils curl software-properties-common iputils-ping gnupg ca-certificates apt-transport-https && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# Install PowerShell - Architecture-specific +RUN case "$TARGETPLATFORM" in \ + "linux/amd64") PWSH_ARCH="x64" ;; \ + "linux/arm64") PWSH_ARCH="arm64" ;; \ + *) echo "Unsupported platform: $TARGETPLATFORM" && exit 1 ;; \ + esac && \ + wget -q https://github.com/PowerShell/PowerShell/releases/download/v${Powershell_Version}/powershell-${Powershell_Version}-linux-${PWSH_ARCH}.tar.gz && \ + mkdir -p /opt/microsoft/powershell/7 && \ + tar zxf powershell-${Powershell_Version}-linux-${PWSH_ARCH}.tar.gz -C /opt/microsoft/powershell/7 && \ + chmod +x /opt/microsoft/powershell/7/pwsh && \ + ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh && \ + rm powershell-${Powershell_Version}-linux-${PWSH_ARCH}.tar.gz + +# Install Octopus/Octo CLI +RUN apt-get update && \ + curl -fsSL https://apt.octopus.com/public.key | gpg --dearmor -o /etc/apt/keyrings/octopus.gpg && \ + ARCH=$(dpkg --print-architecture) && \ + printf "deb [arch=%s signed-by=/etc/apt/keyrings/octopus.gpg] https://apt.octopus.com/ stable main\n" "$ARCH" > /etc/apt/sources.list.d/octopus.list && \ + apt-get update && \ + apt-get install -y octopus-cli=${Octopus_Cli_Version} && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# Install Octopus Client +# https://octopus.com/docs/octopus-rest-api/octopus.client +RUN pwsh -c 'Install-Package -Force Octopus.Client -MaximumVersion "'${Octopus_Client_Version}'" -source https://www.nuget.org/api/v2 -SkipDependencies' && \ + octopusClientPackagePath=$(pwsh -c '(Get-Item ((Get-Package Octopus.Client).source)).Directory.FullName') && \ + cp -r $octopusClientPackagePath/lib/netstandard2.0/* . + +# Install AWS Powershell core modules +# https://docs.aws.amazon.com/powershell/latest/userguide/pstools-getting-set-up-linux-mac.html +RUN pwsh -c 'Install-Module -Force -Name AWSPowerShell.NetCore -AllowClobber -Scope AllUsers -MaximumVersion "'${Aws_Powershell_Version}'"' + +# Install AZ Powershell core modules +# https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-3.6.1 +RUN pwsh -c 'Install-Module -Force -Name Az -AllowClobber -Scope AllUsers -MaximumVersion "'${Azure_Powershell_Version}'"' + +# Install Helm3 +RUN wget --quiet -O - https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash -s -- -v ${Helm_Version} + +# Install .NET SDK +# https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu-install?pivots=os-linux-ubuntu-2404&tabs=dotnet10 +RUN DOTNET_CLI_TELEMETRY_OPTOUT=1 && \ + touch /etc/apt/preferences && \ + echo "Package: dotnet* aspnet* netstandard* \nPin: origin \"packages.microsoft.com\" \nPin-Priority: -10" > /etc/apt/preferences && \ + echo "export DOTNET_CLI_TELEMETRY_OPTOUT=1" > /etc/profile.d/set-dotnet-env-vars.sh && \ + apt-get update && \ + apt-get install -y dotnet-sdk-${Dotnet_Sdk_Version} && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# Install JDK / Tools +# https://ubuntuhandbook.org/index.php/2025/03/install-openjdk-24-ubuntu/ +RUN apt-get update && \ + apt-get install -y --no-install-recommends openjdk-${Java_Jdk_Version}-jdk-headless maven gradle && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# # Install Azure CLI +# # https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt#option-2-step-by-step-installation-instructions +RUN mkdir -p /etc/apt/keyrings && \ + curl -sLS https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | tee /etc/apt/keyrings/microsoft.gpg > /dev/null && \ + chmod go+r /etc/apt/keyrings/microsoft.gpg && \ + AZ_DIST=$(lsb_release -cs) && \ + printf "Types: deb\nURIs: https://packages.microsoft.com/repos/azure-cli/\nSuites: %s\nComponents: main\nArchitectures: %s\nSigned-by: /etc/apt/keyrings/microsoft.gpg\n" "${AZ_DIST}" "$(dpkg --print-architecture)" | tee /etc/apt/sources.list.d/azure-cli.sources && \ + apt-get update && \ + apt-get install -y azure-cli=${Azure_Cli_Version} && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + # remove az cli warning - https://github.com/Azure/arm-deploy/issues/173 + az config set bicep.use_binary_from_path=false + +# Install NodeJS +RUN wget --quiet -O - https://deb.nodesource.com/setup_${NodeJs_Version}.x | bash && \ + apt-get install -y nodejs && \ + rm -rf /var/lib/apt/lists/* + +# Install kubectl +# https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/#install-using-native-package-management +RUN curl -fsSL "https://pkgs.k8s.io/core:/stable:/v${Kubectl_Version}/deb/Release.key" | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg && \ + echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v${Kubectl_Version}/deb/ /" | tee /etc/apt/sources.list.d/kubernetes.list && \ + apt-get update && \ + apt-get install -y kubectl=${Kubectl_Version}.* && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# Install Kubelogin - Architecture-specific +RUN case "$TARGETPLATFORM" in \ + "linux/amd64") KUBELOGIN_ARCH="amd64" ;; \ + "linux/arm64") KUBELOGIN_ARCH="arm64" ;; \ + *) echo "Unsupported platform: $TARGETPLATFORM" && exit 1 ;; \ + esac && \ + wget --quiet https://github.com/Azure/kubelogin/releases/download/${Kubelogin_Version}/kubelogin-linux-${KUBELOGIN_ARCH}.zip && \ + unzip kubelogin-linux-${KUBELOGIN_ARCH}.zip -d kubelogin-linux-${KUBELOGIN_ARCH} && \ + mv kubelogin-linux-${KUBELOGIN_ARCH}/bin/linux_${KUBELOGIN_ARCH}/kubelogin /usr/local/bin && \ + rm -rf kubelogin-linux-${KUBELOGIN_ARCH} && \ + rm kubelogin-linux-${KUBELOGIN_ARCH}.zip + +# Install Terraform - Architecture-specific +# https://computingforgeeks.com/how-to-install-terraform-on-ubuntu-centos-7/ +RUN case "$TARGETPLATFORM" in \ + "linux/amd64") TERRAFORM_ARCH="amd64" ;; \ + "linux/arm64") TERRAFORM_ARCH="arm64" ;; \ + *) echo "Unsupported platform: $TARGETPLATFORM" && exit 1 ;; \ + esac && \ + wget --quiet https://releases.hashicorp.com/terraform/${Terraform_Version}/terraform_${Terraform_Version}_linux_${TERRAFORM_ARCH}.zip && \ + unzip terraform_${Terraform_Version}_linux_${TERRAFORM_ARCH}.zip && \ + mv terraform /usr/local/bin && \ + rm terraform_${Terraform_Version}_linux_${TERRAFORM_ARCH}.zip + +# Install Google Cloud CLI - Architecture-specific recommended install method +# https://docs.cloud.google.com/sdk/docs/install-sdk#deb +RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg && \ + echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \ + apt-get update && apt-get install -y --no-install-recommends google-cloud-cli=${Google_Cloud_Cli_Version} google-cloud-cli-gke-gcloud-auth-plugin=${Google_Cloud_Gke_Cloud_Auth_Plugin_Version} && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# Install pip & groff +# Ubuntu 24.04 requires --break-system-packages due to PEP 668 +# https://peps.python.org/pep-0668/ +RUN apt-get update && \ + apt-get install -y python3-pip groff && \ + python3 -m pip install pycryptodome --user --break-system-packages && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + + +# # Install AWS CLI +# # https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html +RUN case "$TARGETPLATFORM" in \ + "linux/amd64") AWS_CLI_ARCH="x86_64" ;; \ + "linux/arm64") AWS_CLI_ARCH="aarch64" ;; \ + *) echo "Unsupported platform: $TARGETPLATFORM" && exit 1 ;; \ + esac && \ + curl -L "https://awscli.amazonaws.com/awscli-exe-linux-${AWS_CLI_ARCH}-${Aws_Cli_Version}.zip" -o "awscliv2.zip" && \ + unzip -q awscliv2.zip && \ + ./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli && \ + rm -f awscliv2.zip && \ + rm -rf ./aws + +# Install EKS CLI +# https://github.com/weaveworks/eksctl +RUN case "$TARGETPLATFORM" in \ + "linux/amd64") EKS_CLI_ARCH="amd64" ;; \ + "linux/arm64") EKS_CLI_ARCH="arm64" ;; \ + *) echo "Unsupported platform: $TARGETPLATFORM" && exit 1 ;; \ + esac && \ + curl --silent --location "https://github.com/eksctl-io/eksctl/releases/download/v0.220.0/eksctl_Linux_${EKS_CLI_ARCH}.tar.gz" | tar xz -C /tmp && \ + mv /tmp/eksctl /usr/local/bin + +# Install ECS CLI +## https://github.com/aws/amazon-ecs-cli +RUN case "$TARGETPLATFORM" in \ + "linux/amd64") ECS_CLI_ARCH="amd64" ;; \ + "linux/arm64") ECS_CLI_ARCH="arm64" ;; \ + *) echo "Unsupported platform: $TARGETPLATFORM" && exit 1 ;; \ + esac && \ + curl --silent --location "https://amazon-ecs-cli.s3.amazonaws.com/ecs-cli-linux-${ECS_CLI_ARCH}-v${Ecs_Cli_Version}" -o /usr/local/bin/ecs-cli && \ + chmod +x /usr/local/bin/ecs-cli + +# Install AWS IAM Authenticator +# https://docs.aws.amazon.com/eks/latest/userguide/install-aws-iam-authenticator.html +RUN case "$TARGETPLATFORM" in \ + "linux/amd64") AWS_IAM_ARCH="amd64" ;; \ + "linux/arm64") AWS_IAM_ARCH="arm64" ;; \ + *) echo "Unsupported platform: $TARGETPLATFORM" && exit 1 ;; \ + esac && \ + curl --silent --location https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v${Aws_Iam_Authenticator_Version}/aws-iam-authenticator_${Aws_Iam_Authenticator_Version}_linux_${AWS_IAM_ARCH} -o /usr/local/bin/aws-iam-authenticator && \ + chmod +x /usr/local/bin/aws-iam-authenticator + +## Install Istio CLI +## https://istio.io/docs/ops/diagnostic-tools/istioctl/ +RUN curl -sL https://istio.io/downloadIstioctl | sh - && \ + mv /root/.istioctl/bin/istioctl /usr/local/bin/istioctl && \ + rm -rf /root/.istioctl + +# Install Linkerd CLI +# https://linkerd.io/2/getting-started/ +RUN curl --proto '=https' --tlsv1.2 -sSfL https://run.linkerd.io/install-edge | sh +ENV LINKERD_HOME=/root/.linkerd2 +ENV PATH="${LINKERD_HOME}/bin:${PATH}" + + +# Install Argo CD +RUN case "$TARGETPLATFORM" in \ + "linux/amd64") ARGO_ARCH="amd64" ;; \ + "linux/arm64") ARGO_ARCH="arm64" ;; \ + *) echo "Unsupported platform: $TARGETPLATFORM" && exit 1 ;; \ + esac && \ + curl -sSL -o argocd-linux-${ARGO_ARCH} https://github.com/argoproj/argo-cd/releases/download/v${Argocd_Version}/argocd-linux-${ARGO_ARCH} && \ + install -m 555 argocd-linux-${ARGO_ARCH} /usr/local/bin/argocd && \ + rm argocd-linux-${ARGO_ARCH} + +# Get common utilities for scripting +# https://mikefarah.gitbook.io/yq/ +# https://augeas.net/ +# Install yq from GitHub releases (PPA doesn't support Ubuntu 24.04) +RUN apt-get update && apt-get install -y jq openssh-client rsync git augeas-tools xxd && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + case "$TARGETPLATFORM" in \ + "linux/amd64") YQ_ARCH="amd64" ;; \ + "linux/arm64") YQ_ARCH="arm64" ;; \ + *) echo "Unsupported platform: $TARGETPLATFORM" && exit 1 ;; \ + esac && \ + wget --quiet https://github.com/mikefarah/yq/releases/latest/download/yq_linux_${YQ_ARCH} -O /usr/bin/yq && \ + chmod +x /usr/bin/yq + +RUN rm -rf /usr/share/doc /usr/share/man /usr/share/info /var/cache/* diff --git a/ubuntu.24.04/README.md b/ubuntu.24.04/README.md new file mode 100644 index 0000000..9d2c49c --- /dev/null +++ b/ubuntu.24.04/README.md @@ -0,0 +1,67 @@ +# Ubuntu WorkerTools - Noble + +> Please note that we update this document periodically to match the latest version on DockerHub which is publicly available. +> This does not necessarily match the content of Dockerfiles in this repository, as they may contain changes that are not released yet. + +## Image Name + +`octopusdeploy/worker-tools` + +## Tags + +- `6.0.0-ubuntu.24.04-arm64` +- `6.0-ubuntu.24.04-arm64` +- `6-ubuntu.24.04-arm64` +- `ubuntu.24.04-arm64` + +- `6.0.0-ubuntu.24.04-amd64` +- `6.0-ubuntu.24.04-amd64` +- `6-ubuntu.24.04-amd64` +- `ubuntu.24.04-amd64` + +## Base Image + +`ubuntu:24.04` + + +## Installed Software + +- Argo CD CLI 2.14.21 +- Aws CLI 2.24.10 +- Aws Iam Authenticator 0.7.9 +- Aws Powershell 4.1.734 +- Azure CLI 2.67.0 +- Azure Powershell 13.0.0 +- Dotnet Sdk 8.0 +- Ecs CLI 1.21.0 +- Eksctl 0.220.0 +- Google Cloud CLI 550.0.0 +- Google Cloud GKE auth plugin 550.0.0 +- Helm v3.16.4 +- Java Jdk 21 +- Kubectl 1.32 +- Kubelogin v0.1.6 +- NodeJS 22 - latest +- Octopus CLI 2.20.1 +- Octopus Client 14.3.1789 +- Powershell 7.5.4 +- Terraform 1.10.4 +- wget - Latest +- unzip - Latest +- apt-utils - Latest +- curl - Latest +- software-properties-common - Latest +- maven - Latest +- gradle - Latest +- Python2 - 2.7.18 +- Python3 - Latest +- groff - Latest +- Istio CLI - Latest +- Linkerd CLI - Latest +- jq - Latest +- yq - Latest +- openssh-client - Latest +- rsync - Latest +- git - Latest +- augeas-tools - Latest +- xxd - Latest diff --git a/ubuntu.24.04/Tests.Dockerfile b/ubuntu.24.04/Tests.Dockerfile new file mode 100644 index 0000000..94cb776 --- /dev/null +++ b/ubuntu.24.04/Tests.Dockerfile @@ -0,0 +1,4 @@ +ARG ContainerUnderTest=octopusdeploy/worker-tools + +FROM ${ContainerUnderTest} +SHELL ["pwsh", "-Command"] diff --git a/ubuntu.24.04/scripts/run-tests.ps1 b/ubuntu.24.04/scripts/run-tests.ps1 new file mode 100644 index 0000000..ae30688 --- /dev/null +++ b/ubuntu.24.04/scripts/run-tests.ps1 @@ -0,0 +1,22 @@ +Write-Output "##teamcity[blockOpened name='Pester tests']" + +try { + Install-Module -Name "Pester" -MinimumVersion "5.0.2" -Force + + Import-Module -Name "Pester" + + Set-Location /app/spec + + Write-Output "Running Pester Tests" + $configuration = [PesterConfiguration]::Default + $configuration.TestResult.Enabled = $true + $configuration.TestResult.OutputPath = '/app/spec/PesterTestResults.xml' + $configuration.TestResult.OutputFormat = 'NUnitXml' + $configuration.Run.PassThru = $true + $configuration.Output.Verbosity = "Detailed" + + Invoke-Pester -configuration $configuration +} catch { + exit 1 +} +Write-Output "##teamcity[blockClosed name='Pester tests']" diff --git a/ubuntu.24.04/spec/ubuntu.24.04.tests.ps1 b/ubuntu.24.04/spec/ubuntu.24.04.tests.ps1 new file mode 100644 index 0000000..af2a6c8 --- /dev/null +++ b/ubuntu.24.04/spec/ubuntu.24.04.tests.ps1 @@ -0,0 +1,133 @@ +$ErrorActionPreference = "Continue" + +$pesterModules = @( Get-Module -Name "Pester"); +Write-Host 'Running tests with Pester v'+$($pesterModules[0].Version) + +Describe 'installed dependencies' { + It 'has Octopus.Client installed ' { + $expectedVersion = "14.3.1789" + [Reflection.AssemblyName]::GetAssemblyName("/Octopus.Client.dll").Version.ToString() | Should -match "$expectedVersion.0" + } + + It 'has dotnet installed' { + dotnet --version | Should -match '8.0.\d+' + $LASTEXITCODE | Should -be 0 + } + + It 'has java installed' { + java --version | Should -beLike "* 21.0.*" + $LASTEXITCODE | Should -be 0 + } + + It 'has aws powershell module installed' { + (Get-Module AWSPowerShell.NetCore -ListAvailable).Version.ToString() | should -be '4.1.734' + } + + It 'has az installed' { + $output = (& az version) | convertfrom-json + $output.'azure-cli' | Should -be '2.67.0' + $LASTEXITCODE | Should -be 0 + } + + It 'has az powershell module installed' { + (Get-Module Az -ListAvailable).Version.ToString() | should -be '13.0.0' + } + + It 'has aws cli installed' { + aws --version 2>&1 | Should -match '2.24.10' + } + + It 'has node installed' { + node --version | Should -match '22.\d+.\d+' + $LASTEXITCODE | Should -be 0 + } + + It 'has kubectl installed' { + kubectl version --client | Select-Object -First 1 | Should -match '1.32.\d+' + $LASTEXITCODE | Should -be 0 + } + + It 'has kubelogin installed' { + kubelogin --version | Select-Object -First 1 -Skip 1 | Should -match 'v0.1.6' + $LASTEXITCODE | Should -be 0 + } + + It 'has helm installed' { + helm version | Should -match '3.16.4' + $LASTEXITCODE | Should -be 0 + } + + # If the terraform version is not the latest, then `terraform version` returns multiple lines and a non-zero return code + It 'has terraform installed' { + terraform version | Select-Object -First 1 | Should -match '1.10.4' + } + + It 'has python3 installed' { + python3 --version | Should -match '3.12.3' + $LASTEXITCODE | Should -be 0 + } + + It 'has gcloud installed' { + gcloud --version | Select -First 1 | Should -be 'Google Cloud SDK 550.0.0' + $LASTEXITCODE | Should -be 0 + } + + It 'has gke-gcloud-auth-plugin installed' { + #We use belike here as the hash after the 'alpha+' changes and isn't that important + gke-gcloud-auth-plugin --version | Select -First 1 | Should -beLike 'Kubernetes v1.30.0*' + $LASTEXITCODE | Should -be 0 + } + + It 'has octopus cli installed' { + octopus version | Should -match '2.20.1' + $LASTEXITCODE | Should -be 0 + } + + + It 'has eksctl installed' { + eksctl version | Should -match '0.220.0' + $LASTEXITCODE | Should -be 0 + } + + It 'has ecs-cli installed' { + ecs-cli --version | Should -match '1.21.0' + $LASTEXITCODE | Should -be 0 + } + + It 'has mvn installed' { + mvn --version | out-null + $LASTEXITCODE | Should -be 0 + } + + It 'has gradle installed' { + gradle --version | out-null + $LASTEXITCODE | Should -be 0 + } + + It 'has aws-iam-authenticator installed' { + aws-iam-authenticator version | out-null + $LASTEXITCODE | Should -be 0 + } + + It 'has istioctl installed' { + istioctl version --remote=false | out-null + $LASTEXITCODE | Should -be 0 + } + + It 'has linkerd installed' { + linkerd version --client | out-null + $LASTEXITCODE | Should -be 0 + } + + It 'should have installed powershell core' { + $output = & pwsh --version + $LASTEXITCODE | Should -be 0 + $output | Should -match '^PowerShell 7\.5\.4*' + } + + It 'should have installed argo cli' { + $output = (& argocd version --client) -join "`n" + $LASTEXITCODE | Should -be 0 + $output | Should -Match '2.14.21' + } +}