diff --git a/builds/checkin/edgelet.yaml b/builds/checkin/edgelet.yaml index 97b36bcaaa0..62736a6d541 100644 --- a/builds/checkin/edgelet.yaml +++ b/builds/checkin/edgelet.yaml @@ -54,6 +54,33 @@ jobs: displayName: armv7-unknown-linux-gnueabihf test workingDirectory: $(Build.SourcesDirectory)/edgelet + ################################################################################ + - job: linux_arm64v8 + ################################################################################ + displayName: Linux arm64v8 + pool: + vmImage: 'ubuntu-16.04' + variables: + IOTEDGE_HOMEDIR: /tmp + steps: + - bash: 'echo "##vso[task.setvariable variable=PATH;]$HOME/.cargo/bin:$PATH"' + displayName: Modify path + - bash: | + BASE_VERSION=`cat $BUILD_SOURCESDIRECTORY/edgelet/version.txt` + VERSION="$BASE_VERSION$BUILD_BUILDNUMBER" + echo "##vso[task.setvariable variable=VERSION;]$VERSION" + displayName: Set Version + - script: edgelet/build/linux/install.sh + displayName: Install Rust + - script: 'cargo install --git https://github.com/arsing/cross.git --branch set-path' + displayName: 'Install cross (fork with docker fix)' + - script: 'cross build --target aarch64-unknown-linux-gnu' + displayName: aarch64-unknown-linux-gnu build + workingDirectory: $(Build.SourcesDirectory)/edgelet + - script: 'cross test --target aarch64-unknown-linux-gnu' + displayName: aarch64-unknown-linux-gnu test + workingDirectory: $(Build.SourcesDirectory)/edgelet + ################################################################################ - job: windows_amd64 ################################################################################ diff --git a/builds/misc/images.yaml b/builds/misc/images.yaml index ff788ead53c..cd33889e67a 100644 --- a/builds/misc/images.yaml +++ b/builds/misc/images.yaml @@ -35,8 +35,14 @@ jobs: name: build displayName: Build ($(Build.Configuration)) - - script: scripts/linux/buildDiagnostics.sh $(Build.Configuration) - displayName: Build iotedge-diagnostics + - script: scripts/linux/buildEdgelet.sh -i azureiotedge-iotedged -n microsoft -P iotedged -c $(Build.Configuration) -t aarch64 + displayName: Build - Edge Security Daemon - aarch64 + + - script: scripts/linux/buildEdgelet.sh -i azureiotedge-diagnostics -n microsoft -P iotedge-diagnostics -c $(Build.Configuration) -t aarch64 + displayName: Build - Edge Diagnostics - aarch64 + + - script: scripts/linux/buildEdgeProxy.sh -i azureiotedge-proxy -n microsoft -P edge-proxy -t aarch64 + displayName: Build - Edge Proxy - aarch64 - task: PublishBuildArtifacts@1 displayName: 'Publish Artifacts' @@ -44,82 +50,96 @@ jobs: PathtoPublish: '$(Build.BinariesDirectory)/publish' ArtifactName: 'core-linux' - # azureiotedge-diagnostics - Not Using Template for ARM64 because we have 2 different .NET Core. + # Edge Security Daemon - Not Using Template for ARM64 because we have 2 different .NET Core. - task: Bash@3 - displayName: Build Image azureiotedge-diagnostics - aarch64 - inputs: - filePath: scripts/linux/buildImage.sh - arguments: -r $(registry.address) -u $(registry.user) -p $(registry.password) -i azureiotedge-diagnostics -n microsoft -P azureiotedge-diagnostics --target-arch aarch64 + displayName: Build Image - Edge Security Daemon - aarch64 + inputs: + filePath: scripts/linux/buildImage.sh + arguments: -r $(registry.address) -u $(registry.user) -p $(registry.password) -i azureiotedge-iotedged -n microsoft -P azureiotedge-iotedged --target-arch aarch64 + + # Edge Diagnostics - Not Using Template for ARM64 because we have 2 different .NET Core. + - task: Bash@3 + displayName: Build Image - Edge Diagnostics - aarch64 + inputs: + filePath: scripts/linux/buildImage.sh + arguments: -r $(registry.address) -u $(registry.user) -p $(registry.password) -i azureiotedge-diagnostics -n microsoft -P azureiotedge-diagnostics --target-arch aarch64 + + # Edge Proxy - Not Using Template for ARM64 because we have 2 different .NET Core. + - task: Bash@3 + displayName: Build Image - Edge Proxy - aarch64 + inputs: + filePath: scripts/linux/buildImage.sh + arguments: -r $(registry.address) -u $(registry.user) -p $(registry.password) -i azureiotedge-proxy -n microsoft -P azureiotedge-proxy --target-arch aarch64 - # Edge Agent - Not Using Template for ARM64 because we have 2 different .NET Core. + # Edge Agent - Not Using Template for ARM64 because we have 2 different .NET Core. - task: Bash@3 - displayName: Build Edge Agent Image - aarch64 - inputs: + displayName: Build Image - Edge Agent - aarch64 + inputs: filePath: scripts/linux/buildImage.sh arguments: -r $(registry.address) -u $(registry.user) -p $(registry.password) -i azureiotedge-agent -n microsoft -P Microsoft.Azure.Devices.Edge.Agent.Service --target-arch aarch64 # Edge Hub - Not Using Template for ARM64 because we have 2 different .NET Core. - task: Bash@3 - displayName: Build Edge Hub Image - aarch64 - inputs: + displayName: Build Image - Edge Hub - aarch64 + inputs: filePath: scripts/linux/buildImage.sh arguments: -r $(registry.address) -u $(registry.user) -p $(registry.password) -i azureiotedge-hub -n microsoft -P Microsoft.Azure.Devices.Edge.Hub.Service --target-arch aarch64 # Simulated Temperature Sensor - Not Using Template for ARM64 because we have 2 different .NET Core. - task: Bash@3 - displayName: Build Image Temperature Sensor - aarch64 - inputs: + displayName: Build Image - Temperature Sensor - aarch64 + inputs: filePath: scripts/linux/buildImage.sh - arguments: -r $(registry.address) -u $(registry.user) -p $(registry.password) -i azureiotedge-simulated-temperature-sensor -n microsoft -P SimulatedTemperatureSensor --target-arch aarch64 + arguments: -r $(registry.address) -u $(registry.user) -p $(registry.password) -i azureiotedge-simulated-temperature-sensor -n microsoft -P SimulatedTemperatureSensor --target-arch aarch64 # Temperature Filter - Not Using Template for ARM64 because we have 2 different .NET Core. - task: Bash@3 - displayName: Build Image Temperature Filter - aarch64 - inputs: + displayName: Build Image - Temperature Filter - aarch64 + inputs: filePath: scripts/linux/buildImage.sh - arguments: -r $(registry.address) -u $(registry.user) -p $(registry.password) -i azureiotedge-temperature-filter -n microsoft -P TemperatureFilter --target-arch aarch64 - + arguments: -r $(registry.address) -u $(registry.user) -p $(registry.password) -i azureiotedge-temperature-filter -n microsoft -P TemperatureFilter --target-arch aarch64 + # Load Gen - Not Using Template for ARM64 because we have 2 different .NET Core. - task: Bash@3 - displayName: Build Image Load Gen - aarch64 - inputs: + displayName: Build Image - Load Gen - aarch64 + inputs: filePath: scripts/linux/buildImage.sh - arguments: -r $(registry.address) -u $(registry.user) -p $(registry.password) -i azureiotedge-load-gen -n microsoft -P load-gen --target-arch aarch64 - + arguments: -r $(registry.address) -u $(registry.user) -p $(registry.password) -i azureiotedge-load-gen -n microsoft -P load-gen --target-arch aarch64 + # Messages Analyzer - Not Using Template for ARM64 because we have 2 different .NET Core. - task: Bash@3 - displayName: Build Image Messages Analyzer - aarch64 - inputs: + displayName: Build Image - Messages Analyzer - aarch64 + inputs: filePath: scripts/linux/buildImage.sh - arguments: -r $(registry.address) -u $(registry.user) -p $(registry.password) -i azureiotedge-analyzer -n microsoft -P MessagesAnalyzer --target-arch aarch64 + arguments: -r $(registry.address) -u $(registry.user) -p $(registry.password) -i azureiotedge-analyzer -n microsoft -P MessagesAnalyzer --target-arch aarch64 - # Functions Sample - Not Using Template for ARM64 because we have 2 different .NET Core.//TODO: Enable this once Functions supports arm64v8. Right now they are not ready. + # Functions Sample - Not Using Template for ARM64 because we have 2 different .NET Core.//TODO: Enable this once Functions supports arm64v8. Right now they are not ready. #- task: Bash@3 - # displayName: Build Image Functions Sample - aarch64 - # inputs: + # displayName: Build Image - Functions Sample - aarch64 + # inputs: # filePath: scripts/linux/buildImage.sh - # arguments: -r $(registry.address) -u $(registry.user) -p $(registry.password) -i azureiotedge-functions-filter -n azureiotedge -P EdgeHubTriggerCSharp --target-arch aarch64 + # arguments: -r $(registry.address) -u $(registry.user) -p $(registry.password) -i azureiotedge-functions-filter -n azureiotedge -P EdgeHubTriggerCSharp --target-arch aarch64 # Direct Method Sender - Not Using Template for ARM64 because we have 2 different .NET Core. - task: Bash@3 - displayName: Build Image Direct Method Sender - aarch64 - inputs: + displayName: Build Image - Direct Method Sender - aarch64 + inputs: filePath: scripts/linux/buildImage.sh - arguments: -r $(registry.address) -u $(registry.user) -p $(registry.password) -i azureiotedge-direct-method-sender -n microsoft -P DirectMethodSender --target-arch aarch64 + arguments: -r $(registry.address) -u $(registry.user) -p $(registry.password) -i azureiotedge-direct-method-sender -n microsoft -P DirectMethodSender --target-arch aarch64 # Direct Method Receiver - Not Using Template for ARM64 because we have 2 different .NET Core. - task: Bash@3 - displayName: Build Image Direct Method Receiver - aarch64 - inputs: + displayName: Build Image - Direct Method Receiver - aarch64 + inputs: filePath: scripts/linux/buildImage.sh - arguments: -r $(registry.address) -u $(registry.user) -p $(registry.password) -i azureiotedge-direct-method-receiver -n microsoft -P DirectMethodReceiver --target-arch aarch64 + arguments: -r $(registry.address) -u $(registry.user) -p $(registry.password) -i azureiotedge-direct-method-receiver -n microsoft -P DirectMethodReceiver --target-arch aarch64 # Direct Method Cloud Sender - Not Using Template for ARM64 because we have 2 different .NET Core. - task: Bash@3 - displayName: Build Image Direct Method Cloud Sender - aarch64 - inputs: + displayName: Build Image - Direct Method Cloud Sender - aarch64 + inputs: filePath: scripts/linux/buildImage.sh - arguments: -r $(registry.address) -u $(registry.user) -p $(registry.password) -i azureiotedge-direct-method-cloud-sender -n microsoft -P DirectMethodCloudSender --target-arch aarch64 + arguments: -r $(registry.address) -u $(registry.user) -p $(registry.password) -i azureiotedge-direct-method-cloud-sender -n microsoft -P DirectMethodCloudSender --target-arch aarch64 ################################################################################ @@ -151,8 +171,28 @@ jobs: name: build displayName: Build ($(Build.Configuration)) - - script: scripts/linux/buildDiagnostics.sh $(Build.Configuration) - displayName: Build iotedge-diagnostics + - template: templates/build-edgelet-linux.yaml + parameters: + filePath: scripts/linux/buildEdgelet.sh + name: Edge Security Daemon + imageName: azureiotedge-iotedged + project: iotedged + configuration: $(Build.Configuration) + + - template: templates/build-edgelet-linux.yaml + parameters: + filePath: scripts/linux/buildEdgelet.sh + name: Edge Diagnostics + imageName: azureiotedge-diagnostics + project: iotedge-diagnostics + configuration: $(Build.Configuration) + + - template: templates/build-edgelet-linux.yaml + parameters: + filePath: scripts/linux/buildEdgeProxy.sh + name: Edge Proxy + imageName: azureiotedge-proxy + project: edge-proxy - script: scripts/linux/createArtifactInfo.sh --output-folder '$(Build.BinariesDirectory)/publish' --build-number $(Build.BuildNumber) displayName: 'Create Artifact Info File' @@ -163,13 +203,27 @@ jobs: PathtoPublish: '$(Build.BinariesDirectory)/publish' ArtifactName: 'core-linux' - # azureiotedge-diagnostics + # Edge Security Daemon - template: templates/image-linux.yaml parameters: - name: azureiotedge-diagnostics + name: Edge Security Daemon + imageName: azureiotedge-iotedged + project: azureiotedge-iotedged + + # Edge Diagnostics + - template: templates/image-linux.yaml + parameters: + name: Edge Diagnostics imageName: azureiotedge-diagnostics project: azureiotedge-diagnostics + # Edge Proxy + - template: templates/image-linux.yaml + parameters: + name: Edge Proxy + imageName: azureiotedge-proxy + project: azureiotedge-proxy + # Edge Agent - template: templates/image-linux.yaml parameters: @@ -375,5 +429,9 @@ jobs: displayName: 'Publish Edge Hub Manifest' - script: scripts/linux/buildManifest.sh -r $(registry.address) -u $(registry.user) -p $(registry.password) -v $(Build.BuildNumber) -t $(System.DefaultWorkingDirectory)/edge-modules/SimulatedTemperatureSensor/docker/manifest.yaml.template -n microsoft --tags "$(tags)" displayName: 'Publish Temperature Sensor Manifest' + - script: scripts/linux/buildManifest.sh -r $(registry.address) -u $(registry.user) -p $(registry.password) -v $(Build.BuildNumber) -t $(System.DefaultWorkingDirectory)/edgelet/iotedged/docker/manifest.yaml.template -n microsoft --tags "$(tags)" + displayName: 'Publish azureiotedge-iotedged Manifest' - script: scripts/linux/buildManifest.sh -r $(registry.address) -u $(registry.user) -p $(registry.password) -v $(Build.BuildNumber) -t $(System.DefaultWorkingDirectory)/edgelet/iotedge-diagnostics/docker/manifest.yaml.template -n microsoft --tags "$(tags)" displayName: 'Publish azureiotedge-diagnostics Manifest' + - script: scripts/linux/buildManifest.sh -r $(registry.address) -u $(registry.user) -p $(registry.password) -v $(Build.BuildNumber) -t $(System.DefaultWorkingDirectory)/edge-proxy/docker/manifest.yaml.template -n microsoft --tags "$(tags)" + displayName: 'Publish azureiotedge-proxy Manifest' diff --git a/builds/misc/templates/build-edgelet-linux.yaml b/builds/misc/templates/build-edgelet-linux.yaml new file mode 100644 index 00000000000..a0d92268f25 --- /dev/null +++ b/builds/misc/templates/build-edgelet-linux.yaml @@ -0,0 +1,19 @@ +parameters: + name: '' + imageName: '' + namespace: 'microsoft' + project: '' + configuration: 'release' + filePath: '' + +steps: + - task: Bash@3 + displayName: Build - ${{ parameters.name }} - amd64 + inputs: + filePath: ${{ parameters.filePath }} + arguments: -i ${{ parameters.imageName }} -n ${{ parameters.namespace }} -P ${{ parameters.project }} -c ${{ parameters.configuration }} + - task: Bash@3 + displayName: Build - ${{ parameters.name }} - arm32 + inputs: + filePath: ${{ parameters.filePath }} + arguments: -i ${{ parameters.imageName }} -n ${{ parameters.namespace }} -P ${{ parameters.project }} -c ${{ parameters.configuration }} --target-arch armv7l diff --git a/edge-proxy/README.md b/edge-proxy/README.md new file mode 100644 index 00000000000..81e33b4ab64 --- /dev/null +++ b/edge-proxy/README.md @@ -0,0 +1,3 @@ +# Edge Proxy + +This project contains a proxy server for edge modules that runs in kubernetes environment. \ No newline at end of file diff --git a/edge-proxy/docker/linux/amd64/Dockerfile b/edge-proxy/docker/linux/amd64/Dockerfile new file mode 100644 index 00000000000..7859f10ae01 --- /dev/null +++ b/edge-proxy/docker/linux/amd64/Dockerfile @@ -0,0 +1,3 @@ +FROM traefik:v1.7.11-alpine +COPY ./docker/linux/amd64/run.sh / +CMD ["/run.sh"] \ No newline at end of file diff --git a/edge-proxy/docker/linux/arm32v7/Dockerfile b/edge-proxy/docker/linux/arm32v7/Dockerfile new file mode 100644 index 00000000000..547cc450397 --- /dev/null +++ b/edge-proxy/docker/linux/arm32v7/Dockerfile @@ -0,0 +1,3 @@ +FROM arm32v6/traefik:v1.7.11-alpine +COPY ./docker/linux/arm32v7/run.sh / +CMD ["/run.sh"] \ No newline at end of file diff --git a/edge-proxy/docker/linux/arm64v8/Dockerfile b/edge-proxy/docker/linux/arm64v8/Dockerfile new file mode 100644 index 00000000000..51632eb7842 --- /dev/null +++ b/edge-proxy/docker/linux/arm64v8/Dockerfile @@ -0,0 +1,3 @@ +FROM arm64v8/traefik:v1.7.11-alpine +COPY ./docker/linux/arm64v8/run.sh / +CMD ["/run.sh"] \ No newline at end of file diff --git a/edge-proxy/docker/manifest.yaml.template b/edge-proxy/docker/manifest.yaml.template new file mode 100644 index 00000000000..4123a0c394b --- /dev/null +++ b/edge-proxy/docker/manifest.yaml.template @@ -0,0 +1,18 @@ +image: __REGISTRY__/__NAMESPACE__/azureiotedge-proxy:__VERSION__ +tags: __TAGS__ +manifests: + - + image: __REGISTRY__/__NAMESPACE__/azureiotedge-proxy:__VERSION__-linux-amd64 + platform: + architecture: amd64 + os: linux + - + image: __REGISTRY__/__NAMESPACE__/azureiotedge-proxy:__VERSION__-linux-arm32v7 + platform: + architecture: arm + os: linux + - + image: __REGISTRY__/__NAMESPACE__/azureiotedge-proxy:__VERSION__-linux-arm64v8 + platform: + architecture: arm64 + os: linux diff --git a/edge-proxy/src/run.sh b/edge-proxy/src/run.sh new file mode 100755 index 00000000000..98a347b6233 --- /dev/null +++ b/edge-proxy/src/run.sh @@ -0,0 +1,32 @@ +#!/bin/sh +set -e + +# read service account token from filesystem +file="/var/run/secrets/kubernetes.io/serviceaccount/token" +if [ -e "$file" ] +then + token=$(cat "$file") +else + echo "Could not find file $file" + exit 1 +fi + +config_src="/etc/traefik/traefik.toml" +if [ ! -e "$config_src" ] +then + echo "Could not find config ${config_src}" + exit 1 +fi + +# move traefik config to a new place to allow modification +config_dst="/traefik.toml" +cp "$config_src" "$config_dst" + +# find TOKEN placeholders and replace them with a token value +if [ -n "$token" ] +then + sed -i -e "s/__TOKEN__/$token/g" "$config_dst" +fi + +# call traefik entry point script with a new config +/entrypoint.sh -c /traefik.toml diff --git a/edgelet/Cross.toml b/edgelet/Cross.toml index 746235ca0f0..d41a12ab4f1 100644 --- a/edgelet/Cross.toml +++ b/edgelet/Cross.toml @@ -5,8 +5,14 @@ passthrough = [ "IOTEDGE_HOMEDIR", ] +[target.x86_64-unknown-linux-gnu] +image = "azureiotedge/debian-build:9.5-1" + [target.armv7-unknown-linux-gnueabihf] -image = "azureiotedge/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf:0.2" +image = "azureiotedge/gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf:debian_9.5-1" + +[target.aarch64-unknown-linux-gnu] +image = "azureiotedge/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu:debian_9.5-1" [target.armv7-unknown-linux-musleabihf] # Built from rust-embedded/cross#718a19cd68fb09428532d1317515fe7303692b47 with `./build-docker-image.sh armv7-unknown-linux-musleabihf` diff --git a/edgelet/iotedged/docker/linux/amd64/Dockerfile b/edgelet/iotedged/docker/linux/amd64/Dockerfile new file mode 100644 index 00000000000..13cbbfa25fb --- /dev/null +++ b/edgelet/iotedged/docker/linux/amd64/Dockerfile @@ -0,0 +1,14 @@ +FROM debian:9-slim + +RUN apt-get update && apt-get install -y \ + libssl1.0.2 \ + ca-certificates \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /app +ADD ./docker/linux/amd64/libiothsm.so* /app/ +ADD ./docker/linux/amd64/iotedged /app + +ENV LD_LIBRARY_PATH /app + +CMD ["/app/iotedged"] diff --git a/edgelet/iotedged/docker/linux/arm32v7/Dockerfile b/edgelet/iotedged/docker/linux/arm32v7/Dockerfile new file mode 100644 index 00000000000..a08974047f0 --- /dev/null +++ b/edgelet/iotedged/docker/linux/arm32v7/Dockerfile @@ -0,0 +1,9 @@ +FROM azureiotedge/azureiotedge-iotedged-base:1.0-arm32v7 + +WORKDIR /app +ADD ./docker/linux/arm32v7/libiothsm.so* /app/ +ADD ./docker/linux/arm32v7/iotedged /app + +ENV LD_LIBRARY_PATH /app + +CMD ["/app/iotedged"] \ No newline at end of file diff --git a/edgelet/iotedged/docker/linux/arm32v7/base/Dockerfile b/edgelet/iotedged/docker/linux/arm32v7/base/Dockerfile new file mode 100644 index 00000000000..b4b9eb0432f --- /dev/null +++ b/edgelet/iotedged/docker/linux/arm32v7/base/Dockerfile @@ -0,0 +1,6 @@ +FROM arm32v7/debian:9-slim + +RUN apt-get update && apt-get install -y \ + libssl1.0.2 \ + ca-certificates \ + && rm -rf /var/lib/apt/lists/* diff --git a/edgelet/iotedged/docker/linux/arm64v8/Dockerfile b/edgelet/iotedged/docker/linux/arm64v8/Dockerfile new file mode 100644 index 00000000000..ab48150842c --- /dev/null +++ b/edgelet/iotedged/docker/linux/arm64v8/Dockerfile @@ -0,0 +1,9 @@ +FROM azureiotedge/azureiotedge-iotedged-base:1.0-arm64v8 + +WORKDIR /app +ADD ./docker/linux/arm64v8/libiothsm.so* /app/ +ADD ./docker/linux/arm64v8/iotedged /app + +ENV LD_LIBRARY_PATH /app + +CMD ["/app/iotedged"] \ No newline at end of file diff --git a/edgelet/iotedged/docker/linux/arm64v8/base/Dockerfile b/edgelet/iotedged/docker/linux/arm64v8/base/Dockerfile new file mode 100644 index 00000000000..9d172deef73 --- /dev/null +++ b/edgelet/iotedged/docker/linux/arm64v8/base/Dockerfile @@ -0,0 +1,6 @@ +FROM arm64v8/debian:9-slim + +RUN apt-get update && apt-get install -y \ + libssl1.0.2 \ + ca-certificates \ + && rm -rf /var/lib/apt/lists/* diff --git a/edgelet/iotedged/docker/manifest.yaml.template b/edgelet/iotedged/docker/manifest.yaml.template new file mode 100644 index 00000000000..a6cb12ccb6e --- /dev/null +++ b/edgelet/iotedged/docker/manifest.yaml.template @@ -0,0 +1,18 @@ +image: __REGISTRY__/__NAMESPACE__/azureiotedge-iotedged:__VERSION__ +tags: __TAGS__ +manifests: + - + image: __REGISTRY__/__NAMESPACE__/azureiotedge-iotedged:__VERSION__-linux-amd64 + platform: + architecture: amd64 + os: linux + - + image: __REGISTRY__/__NAMESPACE__/azureiotedge-iotedged:__VERSION__-linux-arm32v7 + platform: + architecture: arm + os: linux + - + image: __REGISTRY__/__NAMESPACE__/azureiotedge-iotedged:__VERSION__-linux-arm64v8 + platform: + architecture: arm64 + os: linux \ No newline at end of file diff --git a/scripts/linux/buildDiagnostics.sh b/scripts/linux/buildDiagnostics.sh deleted file mode 100755 index 61a23a1a3ba..00000000000 --- a/scripts/linux/buildDiagnostics.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -# This script builds the iotedge-diagnostics binary that goes into the azureiotedge-diagnostics image, -# for each supported arch (x86_64, arm32v7, arm64v8). -# It then publishes the binaries along with their corresponding dockerfiles to the publish directory, -# so that buildImage.sh can build the container image. - -BUILD_CONFIGURATION=${1:-release} - -if [[ "${BUILD_CONFIGURATION,,}" == 'release' ]]; then - BUILD_CONFIGURATION='release' - BUILD_CONFIG_OPTION='--release' -else - BUILD_CONFIGURATION='debug' - BUILD_CONFIG_OPTION='' -fi - -set -euo pipefail - -VERSIONINFO_FILE_PATH=$BUILD_REPOSITORY_LOCALPATH/versionInfo.json -PUBLISH_FOLDER=$BUILD_BINARIESDIRECTORY/publish -export VERSION="$(cat "$VERSIONINFO_FILE_PATH" | jq '.version' -r)" - -mkdir -p $PUBLISH_FOLDER/azureiotedge-diagnostics/ -cp -R $BUILD_REPOSITORY_LOCALPATH/edgelet/iotedge-diagnostics/docker $PUBLISH_FOLDER/azureiotedge-diagnostics/docker - -cd "$BUILD_REPOSITORY_LOCALPATH/edgelet" - -cross build -p iotedge-diagnostics $BUILD_CONFIG_OPTION --target x86_64-unknown-linux-musl -strip $BUILD_REPOSITORY_LOCALPATH/edgelet/target/x86_64-unknown-linux-musl/$BUILD_CONFIGURATION/iotedge-diagnostics -cp $BUILD_REPOSITORY_LOCALPATH/edgelet/target/x86_64-unknown-linux-musl/$BUILD_CONFIGURATION/iotedge-diagnostics $PUBLISH_FOLDER/azureiotedge-diagnostics/docker/linux/amd64/ - -cross build -p iotedge-diagnostics $BUILD_CONFIG_OPTION --target armv7-unknown-linux-musleabihf -arm-linux-gnueabihf-strip $BUILD_REPOSITORY_LOCALPATH/edgelet/target/armv7-unknown-linux-musleabihf/$BUILD_CONFIGURATION/iotedge-diagnostics -cp $BUILD_REPOSITORY_LOCALPATH/edgelet/target/armv7-unknown-linux-musleabihf/$BUILD_CONFIGURATION/iotedge-diagnostics $PUBLISH_FOLDER/azureiotedge-diagnostics/docker/linux/arm32v7/ - -cross build -p iotedge-diagnostics $BUILD_CONFIG_OPTION --target aarch64-unknown-linux-musl -aarch64-linux-gnu-strip $BUILD_REPOSITORY_LOCALPATH/edgelet/target/aarch64-unknown-linux-musl/$BUILD_CONFIGURATION/iotedge-diagnostics -cp $BUILD_REPOSITORY_LOCALPATH/edgelet/target/aarch64-unknown-linux-musl/$BUILD_CONFIGURATION/iotedge-diagnostics $PUBLISH_FOLDER/azureiotedge-diagnostics/docker/linux/arm64v8/ diff --git a/scripts/linux/buildEdgeProxy.sh b/scripts/linux/buildEdgeProxy.sh new file mode 100755 index 00000000000..85bcd5b2e61 --- /dev/null +++ b/scripts/linux/buildEdgeProxy.sh @@ -0,0 +1,172 @@ +#!/bin/bash + +# This script copies the edge-proxy executable files that goes into the azureiotedge-proxy image, +# for each supported arch (x86_64, arm32v7, arm64v8). +# It then publishes executable files along with their corresponding dockerfiles to the publish directory, +# so that buildImage.sh can build the container image. + +set -e + +############################################################################### +# Define Environment Variables +############################################################################### +ARCH=$(uname -m) +SCRIPT_NAME=$(basename "$0") +PROJECT= +DOCKERFILE= +DOCKER_IMAGENAME= +DEFAULT_DOCKER_NAMESPACE="microsoft" +DOCKER_NAMESPACE=${DEFAULT_DOCKER_NAMESPACE} +BUILD_BINARIESDIRECTORY=${BUILD_BINARIESDIRECTORY:-$BUILD_REPOSITORY_LOCALPATH} +PUBLISH_DIR=${BUILD_BINARIESDIRECTORY}/publish +BUILD_CONFIGURATION="release" + +############################################################################### +# Function to obtain the underlying architecture and check if supported +############################################################################### +check_arch() +{ + if [[ "$ARCH" == "x86_64" ]]; then + ARCH="amd64" + elif [[ "$ARCH" == "armv7l" ]]; then + ARCH="arm32v7" + elif [[ "$ARCH" == "aarch64" ]]; then + ARCH="arm64v8" + else + echo "Unsupported architecture" + exit 1 + fi +} + +############################################################################### +# Print usage information pertaining to this script and exit +############################################################################### +usage() +{ + echo "$SCRIPT_NAME [options]" + echo "Note: Depending on the options you might have to run this as root or sudo." + echo "" + echo "options" + echo " -i, --image-name Image name (e.g. edge-agent)" + echo " -P, --project Project to build image for (e.g. iotedged)" + echo " -t, --target-arch Target architecture (default: uname -m)" + echo " -n, --namespace Docker namespace (default: $DEFAULT_DOCKER_NAMESPACE)" + echo " -c, --configuration Build configuration" + echo "--bin-dir Directory containing the output binaries. Either use this option or set env variable BUILD_BINARIESDIRECTORY" + exit 1; +} + +print_help_and_exit() +{ + echo "Run $SCRIPT_NAME --help for more information." + exit 1 +} + +print_args() +{ + echo "Project: $BUILD_BINARIESDIRECTORY/$PROJECT" + echo "Arch: $ARCH" + echo "Image: $DOCKER_IMAGENAME" + echo "Namespace: $DOCKER_NAMESPACE" + echo "Dockerfile: $DOCKERFILE" + echo +} + +############################################################################### +# Obtain and validate the options supported by this script +############################################################################### +process_args() +{ + save_next_arg=0 + for arg in "$@" + do + if [[ ${save_next_arg} -eq 1 ]]; then + ARCH="$arg" + check_arch + save_next_arg=0 + elif [[ ${save_next_arg} -eq 2 ]]; then + PROJECT="$arg" + save_next_arg=0 + elif [[ ${save_next_arg} -eq 3 ]]; then + DOCKER_IMAGENAME="$arg" + save_next_arg=0 + elif [[ ${save_next_arg} -eq 4 ]]; then + DOCKER_NAMESPACE="$arg" + save_next_arg=0 + elif [[ ${save_next_arg} -eq 5 ]]; then + BUILD_CONFIGURATION="$arg" + save_next_arg=0 + elif [[ ${save_next_arg} -eq 6 ]]; then + BUILD_BINARIESDIRECTORY="$arg" + save_next_arg=0 + else + case "$arg" in + "-h" | "--help" ) usage;; + "-t" | "--target-arch" ) save_next_arg=1;; + "-P" | "--project" ) save_next_arg=2;; + "-i" | "--image-name" ) save_next_arg=3;; + "-n" | "--namespace" ) save_next_arg=4;; + "-c" | "--configuration" ) save_next_arg=5;; + "--bin-dir" ) save_next_arg=6;; + * ) usage;; + esac + fi + done + + if [[ -z ${DOCKER_IMAGENAME} ]]; then + echo "Docker image name parameter invalid" + print_help_and_exit + fi + + if [[ ! -d ${BUILD_BINARIESDIRECTORY} ]]; then + mkdir "$BUILD_BINARIESDIRECTORY" + fi + + DOCKER_DIR="$BUILD_REPOSITORY_LOCALPATH/$PROJECT/docker" + if [[ -z ${DOCKER_DIR} ]] || [[ ! -d ${DOCKER_DIR} ]]; then + echo "No docker directory for $PROJECT at $BUILD_REPOSITORY_LOCALPATH" + print_help_and_exit + fi + + DOCKERFILE="$DOCKER_DIR/linux/$ARCH/Dockerfile" + if [[ ! -f ${DOCKERFILE} ]]; then + echo "No Dockerfile at $DOCKERFILE" + print_help_and_exit + fi +} + +############################################################################### +# Build project and publish result +############################################################################### +build_project() +{ + # prepare docker folder + local EXE_DOCKER_DIR="$PUBLISH_DIR/$DOCKER_IMAGENAME/docker/linux/$ARCH" + mkdir -p "$EXE_DOCKER_DIR" + + # copy Dockerfile to publish folder for given arch + local EXE_DOCKERFILE="$EXE_DOCKER_DIR/Dockerfile" + execute cp "$DOCKERFILE" "$EXE_DOCKERFILE" + + # copy executables to publish folder + execute cp "$BUILD_REPOSITORY_LOCALPATH/edge-proxy/src/run.sh" "$EXE_DOCKER_DIR/" +} + +############################################################################### +# Print given command and execute it +############################################################################### +execute() +{ + echo "\$" "$*" + "$@" + echo +} + +############################################################################### +# Main Script Execution +############################################################################### +check_arch +process_args "$@" + +print_args +build_project diff --git a/scripts/linux/buildEdgelet.sh b/scripts/linux/buildEdgelet.sh new file mode 100755 index 00000000000..be0a31b5651 --- /dev/null +++ b/scripts/linux/buildEdgelet.sh @@ -0,0 +1,216 @@ +#!/bin/bash + +# This script copies the iodedged executable files that go into the azureiotedge-iotedged image, +# for each supported arch (x86_64, arm32v7, arm64v8). +# It then publishes executable files along with their corresponding dockerfiles to the publish directory, +# so that buildImage.sh can build the container image. + +set -e + +############################################################################### +# Define Environment Variables +############################################################################### +ARCH=$(uname -m) +TOOLCHAIN= +STRIP= +SCRIPT_NAME=$(basename "$0") +PROJECT= +DOCKERFILE= +DOCKER_IMAGENAME= +DEFAULT_DOCKER_NAMESPACE="microsoft" +DOCKER_NAMESPACE=${DEFAULT_DOCKER_NAMESPACE} +BUILD_BINARIESDIRECTORY=${BUILD_BINARIESDIRECTORY:-$BUILD_REPOSITORY_LOCALPATH} +PUBLISH_DIR=${BUILD_BINARIESDIRECTORY}/publish +EDGELET_DIR=${BUILD_REPOSITORY_LOCALPATH}/edgelet +BUILD_CONFIGURATION="release" +BUILD_CONFIG_OPTION= + +############################################################################### +# Function to obtain the underlying architecture and check if supported +############################################################################### +check_arch() +{ + if [[ "$ARCH" == "x86_64" ]]; then + ARCH="amd64" + elif [[ "$ARCH" == "armv7l" ]]; then + ARCH="arm32v7" + elif [[ "$ARCH" == "aarch64" ]]; then + ARCH="arm64v8" + else + echo "Unsupported architecture" + exit 1 + fi +} + +############################################################################### +# Print usage information pertaining to this script and exit +############################################################################### +usage() +{ + echo "$SCRIPT_NAME [options]" + echo "Note: Depending on the options you might have to run this as root or sudo." + echo "" + echo "options" + echo " -i, --image-name Image name (e.g. edge-agent)" + echo " -P, --project Project to build image for (e.g. iotedged)" + echo " -t, --target-arch Target architecture (default: uname -m)" + echo " -n, --namespace Docker namespace (default: $DEFAULT_DOCKER_NAMESPACE)" + echo " -c, --configuration Build configuration (default: release)" + echo "--bin-dir Directory containing the output binaries. Either use this option or set env variable BUILD_BINARIESDIRECTORY" + exit 1; +} + +print_help_and_exit() +{ + echo "Run $SCRIPT_NAME --help for more information." + exit 1 +} + +print_args() +{ + echo "Project: $EDGELET_DIR/$PROJECT" + echo "Arch: $ARCH" + echo "Toolchain: $TOOLCHAIN" + echo "Image: $DOCKER_IMAGENAME" + echo "Namespace: $DOCKER_NAMESPACE" + echo "Dockerfile: $DOCKERFILE" + echo +} + +############################################################################### +# Obtain and validate the options supported by this script +############################################################################### +process_args() +{ + save_next_arg=0 + for arg in "$@" + do + if [[ ${save_next_arg} -eq 1 ]]; then + ARCH="$arg" + check_arch + save_next_arg=0 + elif [[ ${save_next_arg} -eq 2 ]]; then + PROJECT="$arg" + save_next_arg=0 + elif [[ ${save_next_arg} -eq 3 ]]; then + DOCKER_IMAGENAME="$arg" + save_next_arg=0 + elif [[ ${save_next_arg} -eq 4 ]]; then + DOCKER_NAMESPACE="$arg" + save_next_arg=0 + elif [[ ${save_next_arg} -eq 5 ]]; then + BUILD_CONFIGURATION="$arg" + save_next_arg=0 + elif [[ ${save_next_arg} -eq 6 ]]; then + BUILD_BINARIESDIRECTORY="$arg" + save_next_arg=0 + else + case "$arg" in + "-h" | "--help" ) usage;; + "-t" | "--target-arch" ) save_next_arg=1;; + "-P" | "--project" ) save_next_arg=2;; + "-i" | "--image-name" ) save_next_arg=3;; + "-n" | "--namespace" ) save_next_arg=4;; + "-c" | "--configuration" ) save_next_arg=5;; + "--bin-dir" ) save_next_arg=6;; + * ) usage;; + esac + fi + done + + if [[ ${PROJECT,,} == "iotedged" ]]; then + LIBC="glibc" + else + LIBC="musl" + fi + + case ${ARCH}_${LIBC} in + amd64_musl) TOOLCHAIN="x86_64-unknown-linux-musl";; + amd64_glibc) TOOLCHAIN="x86_64-unknown-linux-gnu";; + arm32v7_musl) TOOLCHAIN="armv7-unknown-linux-musleabihf";; + arm32v7_glibc) TOOLCHAIN="armv7-unknown-linux-gnueabihf";; + arm64v8_musl) TOOLCHAIN="aarch64-unknown-linux-musl";; + arm64v8_glibc) TOOLCHAIN="aarch64-unknown-linux-gnu";; + esac + + case ${ARCH} in + amd64) STRIP="strip";; + arm32v7) STRIP="arm-linux-gnueabihf-strip";; + arm64v8) STRIP="aarch64-linux-gnu-strip";; + esac + + if [[ -z ${DOCKER_IMAGENAME} ]]; then + echo "Docker image name parameter invalid" + print_help_and_exit + fi + + if [[ ! -d ${BUILD_BINARIESDIRECTORY} ]]; then + mkdir "${BUILD_BINARIESDIRECTORY}" + fi + + DOCKER_DIR=${EDGELET_DIR}/${PROJECT}/docker + if [[ -z ${DOCKER_DIR} ]] || [[ ! -d ${DOCKER_DIR} ]]; then + echo "No docker directory for $PROJECT at $EDGELET_DIR" + print_help_and_exit + fi + + DOCKERFILE="$DOCKER_DIR/linux/$ARCH/Dockerfile" + if [[ ! -f ${DOCKERFILE} ]]; then + echo "No Dockerfile at $DOCKERFILE" + print_help_and_exit + fi + + if [[ ${BUILD_CONFIGURATION,,} == "release" ]]; then + BUILD_CONFIGURATION='release' + BUILD_CONFIG_OPTION='--release' + else + BUILD_CONFIGURATION='debug' + BUILD_CONFIG_OPTION='' + fi +} + +############################################################################### +# Build project and publish result +############################################################################### +build_project() +{ + # build project with cross + cd "$EDGELET_DIR" + + execute cross build -p "$PROJECT" "$BUILD_CONFIG_OPTION" --target "$TOOLCHAIN" + execute "$STRIP" "$EDGELET_DIR/target/$TOOLCHAIN/$BUILD_CONFIGURATION/$PROJECT" + + # prepare docker folder + local EXE_DOCKER_DIR="$PUBLISH_DIR/$DOCKER_IMAGENAME/docker/linux/$ARCH" + mkdir -p "$EXE_DOCKER_DIR" + + # copy Dockerfile to publish folder for given arch + local EXE_DOCKERFILE="$EXE_DOCKER_DIR/Dockerfile" + execute cp "$DOCKERFILE" "$EXE_DOCKERFILE" + + # copy binaries to publish folder + execute cp "$EDGELET_DIR/target/$TOOLCHAIN/$BUILD_CONFIGURATION/$PROJECT" "$EXE_DOCKER_DIR/" + + if [[ ${PROJECT,,} == "iotedged" ]] && [[ ${BUILD_CONFIGURATION} == "release" ]]; then + execute cp "$EDGELET_DIR"/target/"$TOOLCHAIN"/"$BUILD_CONFIGURATION"/build/hsm-sys-*/out/lib/*.so* "$EXE_DOCKER_DIR/" + fi +} + +############################################################################### +# Print given command and execute it +############################################################################### +execute() +{ + echo "\$ $*" + "$@" + echo +} + +############################################################################### +# Main Script Execution +############################################################################### +check_arch +process_args "$@" + +print_args +build_project diff --git a/scripts/linux/buildImage.sh b/scripts/linux/buildImage.sh index b209b6533d0..03cd9f1f9f9 100755 --- a/scripts/linux/buildImage.sh +++ b/scripts/linux/buildImage.sh @@ -13,14 +13,14 @@ set -e # Define Environment Variables ############################################################################### ARCH=$(uname -m) -SCRIPT_NAME=$(basename $0) +SCRIPT_NAME=$(basename "$0") PUBLISH_DIR= BASE_TAG= PROJECT= DOCKERFILE= DOCKER_IMAGENAME= DEFAULT_DOCKER_NAMESPACE="microsoft" -DOCKER_NAMESPACE=$DEFAULT_DOCKER_NAMESPACE +DOCKER_NAMESPACE=${DEFAULT_DOCKER_NAMESPACE} BUILD_BINARIESDIRECTORY=${BUILD_BINARIESDIRECTORY:=""} SKIP_PUSH=0 @@ -29,11 +29,11 @@ SKIP_PUSH=0 ############################################################################### check_arch() { - if [ "$ARCH" == "x86_64" ]; then + if [[ "$ARCH" == "x86_64" ]]; then ARCH="amd64" - elif [ "$ARCH" == "armv7l" ]; then + elif [[ "$ARCH" == "armv7l" ]]; then ARCH="arm32v7" - elif [ "$ARCH" == "aarch64" ]; then + elif [[ "$ARCH" == "aarch64" ]]; then ARCH="arm64v8" else echo "Unsupported architecture" @@ -76,37 +76,37 @@ print_help_and_exit() process_args() { save_next_arg=0 - for arg in $@ + for arg in "$@" do - if [ $save_next_arg -eq 1 ]; then + if [[ ${save_next_arg} -eq 1 ]]; then DOCKER_REGISTRY="$arg" save_next_arg=0 - elif [ $save_next_arg -eq 2 ]; then + elif [[ ${save_next_arg} -eq 2 ]]; then DOCKER_USERNAME="$arg" save_next_arg=0 - elif [ $save_next_arg -eq 3 ]; then + elif [[ ${save_next_arg} -eq 3 ]]; then DOCKER_PASSWORD="$arg" save_next_arg=0 - elif [ $save_next_arg -eq 4 ]; then + elif [[ ${save_next_arg} -eq 4 ]]; then DOCKER_IMAGEVERSION="$arg" save_next_arg=0 - elif [ $save_next_arg -eq 5 ]; then + elif [[ ${save_next_arg} -eq 5 ]]; then BUILD_BINARIESDIRECTORY="$arg" save_next_arg=0 - elif [ $save_next_arg -eq 6 ]; then + elif [[ ${save_next_arg} -eq 6 ]]; then BASE_TAG="$arg" save_next_arg=0 - elif [ $save_next_arg -eq 7 ]; then + elif [[ ${save_next_arg} -eq 7 ]]; then ARCH="$arg" check_arch save_next_arg=0 - elif [ $save_next_arg -eq 8 ]; then + elif [[ ${save_next_arg} -eq 8 ]]; then PROJECT="$arg" save_next_arg=0 - elif [ $save_next_arg -eq 9 ]; then + elif [[ ${save_next_arg} -eq 9 ]]; then DOCKER_IMAGENAME="$arg" save_next_arg=0 - elif [ $save_next_arg -eq 10 ]; then + elif [[ ${save_next_arg} -eq 10 ]]; then DOCKER_NAMESPACE="$arg" save_next_arg=0 else @@ -133,7 +133,7 @@ process_args() print_help_and_exit fi - if [[ $SKIP_PUSH -eq 0 ]]; then + if [[ ${SKIP_PUSH} -eq 0 ]]; then if [[ -z ${DOCKER_USERNAME} ]]; then echo "Docker username parameter invalid" print_help_and_exit @@ -151,8 +151,8 @@ process_args() fi if [[ -z ${DOCKER_IMAGEVERSION} ]]; then - if [ ! -z "${BUILD_BUILDNUMBER}" ]; then - DOCKER_IMAGEVERSION=$BUILD_BUILDNUMBER + if [[ -n "${BUILD_BUILDNUMBER}" ]]; then + DOCKER_IMAGEVERSION=${BUILD_BUILDNUMBER} else echo "Docker image version not found." print_help_and_exit @@ -164,22 +164,22 @@ process_args() print_help_and_exit fi - PUBLISH_DIR=$BUILD_BINARIESDIRECTORY/publish + PUBLISH_DIR=${BUILD_BINARIESDIRECTORY}/publish - if [[ ! -d $PUBLISH_DIR ]]; then + if [[ ! -d ${PUBLISH_DIR} ]]; then echo "Publish directory does not exist or is invalid" print_help_and_exit fi + EXE_DOCKER_DIR=${PUBLISH_DIR}/${PROJECT}/docker - EXE_DOCKER_DIR=$PUBLISH_DIR/$PROJECT/docker if [[ -z ${EXE_DOCKER_DIR} ]] || [[ ! -d ${EXE_DOCKER_DIR} ]]; then echo "No docker directory for $PROJECT at $EXE_DOCKER_DIR" print_help_and_exit fi DOCKERFILE="$EXE_DOCKER_DIR/linux/$ARCH/Dockerfile" - if [[ ! -f $DOCKERFILE ]]; then + if [[ ! -f ${DOCKERFILE} ]]; then echo "No Dockerfile at $DOCKERFILE" print_help_and_exit fi @@ -202,9 +202,9 @@ docker_build_and_tag_and_push() arch="$2" dockerfile="$3" context_path="$4" - build_args="${@:5}" + build_args="$5" - if [ -z "${imagename}" ] || [ -z "${arch}" ] || [ -z "${context_path}" ]; then + if [[ -z "${imagename}" ]] || [[ -z "${arch}" ]] || [[ -z "${context_path}" ]]; then echo "Error: Arguments are invalid [$imagename] [$arch] [$context_path]" exit 1 fi @@ -212,25 +212,25 @@ docker_build_and_tag_and_push() echo "Building and pushing Docker image $imagename for $arch" docker_build_cmd="docker build --no-cache" docker_build_cmd+=" -t $DOCKER_REGISTRY/$DOCKER_NAMESPACE/$imagename:$DOCKER_IMAGEVERSION-linux-$arch" - if [ ! -z "${dockerfile}" ]; then + if [[ -n "${dockerfile}" ]]; then docker_build_cmd+=" --file $dockerfile" fi docker_build_cmd+=" $build_args $context_path" echo "Running... $docker_build_cmd" - $docker_build_cmd + ${docker_build_cmd} - if [ $? -ne 0 ]; then + if [[ $? -ne 0 ]]; then echo "Docker build failed with exit code $?" exit 1 fi - if [ $SKIP_PUSH -eq 0 ]; then + if [[ ${SKIP_PUSH} -eq 0 ]]; then docker_push_cmd="docker push $DOCKER_REGISTRY/$DOCKER_NAMESPACE/$imagename:$DOCKER_IMAGEVERSION-linux-$arch" echo "Running... $docker_push_cmd" - $docker_push_cmd - if [ $? -ne 0 ]; then + ${docker_push_cmd} + if [[ $? -ne 0 ]]; then echo "Docker push failed with exit code $?" exit 1 fi @@ -246,16 +246,16 @@ check_arch process_args "$@" # log in to container registry -if [ $SKIP_PUSH -eq 0 ]; then - docker login $DOCKER_REGISTRY -u $DOCKER_USERNAME -p $DOCKER_PASSWORD - if [ $? -ne 0 ]; then +if [[ ${SKIP_PUSH} -eq 0 ]]; then + docker login "${DOCKER_REGISTRY}" -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}" + if [[ $? -ne 0 ]]; then echo "Docker login failed!" exit 1 fi fi build_args=( "EXE_DIR=." ) -[ -z "$BASE_TAG" ] || build_args+=( "base_tag=$BASE_TAG" ) +[[ -z "$BASE_TAG" ]] || build_args+=( "base_tag=$BASE_TAG" ) # push image docker_build_and_tag_and_push \ @@ -264,8 +264,8 @@ docker_build_and_tag_and_push \ "$DOCKERFILE" \ "$PUBLISH_DIR/$PROJECT" \ "${build_args[@]/#/--build-arg }" -[ $? -eq 0 ] || exit $? +[[ $? -eq 0 ]] || exit $? echo "Done building and pushing Docker image $DOCKER_IMAGENAME for $PROJECT" -[ $? -eq 0 ] || exit $? +[[ $? -eq 0 ]] || exit $?