Skip to content

Problem building iotedge packages from Azure Build Pipeline #4397

Description

@gri6507

I am trying to build the itoedge packages following https://github.com/Azure/iotedge/blob/master/edgelet/doc/devguide.md#building-os-packages inside an Azure YAML Build Pipeline (Ubuntu base image). The relevant steps from the pipeline are exactly the same as the ones from the instructions. The relevant YAML code is

- task: Bash@3
  displayName: Build package
  inputs:
    targetType: 'inline'
    script: |
      set -eux
  
      # Add the certificates to resolve the remote git repo URL. Add Curl and GPG to add the repo to get Moby
      DEBIAN_FRONTEND=noninteractive apt-get update
      DEBIAN_FRONTEND=noninteractive apt-get install -yq ca-certificates curl gpg
      update-ca-certificates
  
      # Add the microsoft repo so that we can get Moby (aka docker) runtime. See https://docs.microsoft.com/en-us/azure/iot-edge/how-to-install-iot-edge-linux
      curl https://packages.microsoft.com/config/ubuntu/$(DIST_RELEASE)/prod.list > /etc/apt/sources.list.d/microsoft-prod.list
      curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.gpg
      DEBIAN_FRONTEND=noninteractive apt-get update
      DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends moby-engine moby-cli
  
      # From https://github.com/Azure/iotedge/blob/master/edgelet/doc/devguide.md
      git clone --recurse-submodules https://github.com/Azure/iotedge
      cd iotedge
      PACKAGE_OS=$(DIST_VENDOR)$(DIST_RELEASE) PACKAGE_ARCH=amd64 ./edgelet/build/linux/package.sh

However, when I run this, I get an error inside package.sh which says cat: /__w/75/s/edgelet/version.txt: No such file or directory. To troubleshoot this, I've added some debug prints to the top of package.sh so that it now looks like this

#!/bin/bash

set -e

echo "@@@ package.sh - me = $0"
echo "@@@ package.sh - dirname = $(dirname "$0")"

# Get directory of running script
DIR="$(cd "$(dirname "$0")" && pwd)"
echo "@@@ package.sh - DIR = $DIR"

BUILD_REPOSITORY_LOCALPATH="$(realpath "${BUILD_REPOSITORY_LOCALPATH:-$DIR/../../..}")"
echo "@@@ package.sh - BUILD_REPOSITORY_LOCALPATH = $BUILD_REPOSITORY_LOCALPATH"

When I run the build pipeline with this modification, this sheds some more light on the error, producing the following output

@@@ package.sh - me = ./edgelet/build/linux/package.sh
@@@ package.sh - dirname = ./edgelet/build/linux
@@@ package.sh - DIR = /__w/75/s/iotedge/edgelet/build/linux
@@@ package.sh - BUILD_REPOSITORY_LOCALPATH = /__w/75/s
cat: /__w/75/s/edgelet/version.txt: No such file or directory

Clearly, something went wrong with generating BUILD_REPOSITORY_LOCALPATH from DIR.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions