Azure / azure-cli

Azure Command-Line Interface
MIT License
3.97k stars 2.95k forks source link

Debian packaging attempt was unsuccessful #22160

Open rayluo opened 2 years ago

rayluo commented 2 years ago

Describe the bug My attempt following the Debian Packaging instruction was unsuccessful. I'm not sure whether this is a bug or just I did it wrong.

To Reproduce

  1. git clone the azure cli repo, use its dev branch
  2. cd into the root of that repo
  3. run the following command
    $ docker build --target build-env -f ./scripts/release/debian/Dockerfile -t azure/azure-cli:ubuntu-builder .
    Sending build context to Docker daemon  20.15MB
    Step 1/16 : ARG base_image=ubuntu:xenial
    Step 2/16 : FROM ${base_image} AS build-env
    ---> b6f507652425
    Step 3/16 : RUN apt-get update
    ---> Using cache
    ---> 9e83a6972a6f
    Step 4/16 : RUN apt-get install -y libssl-dev libffi-dev python3-dev debhelper zlib1g-dev wget
    ---> Using cache
    ---> 12ec0aa4815a
    Step 5/16 : ARG python_version="3.8.12"
    ---> Using cache
    ---> ec5f360ffc99
    Step 6/16 : ENV PYTHON_SRC_DIR=/usr/src/python
    ---> Using cache
    ---> c6bee8f4c091
    Step 7/16 : RUN mkdir -p ${PYTHON_SRC_DIR} &&     wget -qO- https://www.python.org/ftp/python/${python_version}/Python-${python_version}.tgz     | tar -xz -C "${PYTHON_SRC_DIR}"
    ---> Using cache
    ---> 593576ce545f
    Step 8/16 : WORKDIR /azure-cli
    ---> Using cache
    ---> 974f19147a61
    Step 9/16 : RUN ${PYTHON_SRC_DIR}/*/configure --srcdir ${PYTHON_SRC_DIR}/* --prefix $(pwd)/python_env &&    make &&     make install &&     ln /azure-cli/python_env/bin/python3 /azure-cli/python_env/bin/python &&     ln /azure-cli/python_env/bin/pip3 /azure-cli/python_env/bin/pip
    ---> Using cache
    ---> 0d15175025ce
    Step 10/16 : ENV PATH=/azure-cli/python_env/bin:$PATH
    ---> Using cache
    ---> 6f9add18fcdb
    Step 11/16 : RUN pip install wheel
    ---> Using cache
    ---> ad4f8dbeba79
    Step 12/16 : COPY . .
    ---> 4d4f3c04f01f
    Step 13/16 : RUN mkdir -p ./bin/pypi &&     BUILD_STAGINGDIRECTORY=/azure-cli/bin/pypi ./scripts/release/pypi/build.sh &&     if [ -d ./privates ]; then find ./privates -name '*.whl' | xargs pip install; fi &&     find ./bin/pypi -name '*.whl' | xargs pip install &&
    ---> Running in eb1377eb28e4
    /bin/sh: 1: Syntax error: end of file unexpected
    The command '/bin/sh -c mkdir -p ./bin/pypi &&     BUILD_STAGINGDIRECTORY=/azure-cli/bin/pypi ./scripts/release/pypi/build.sh &&     if [ -d ./privates ]; then find ./privates -name '*.whl' | xargs pip install; fi &&     find ./bin/pypi -name '*.whl' | xargs pip install &&' returned a non-zero code: 2

Expected behavior Well, a docker-based workflow is expected to work regardless of my local environment.

Environment summary OS: A debian-variant, with Linux kernel 4.9 Shell type: Bash

Additional context I was trying to see if I could build a debian package for the Cloud Shell team to explore.

yonzhan commented 2 years ago

@jiasli for awareness

jiasli commented 2 years ago

scripts/release/debian/Dockerfile hasn't been maintained for a long time, a long time (since 2019-01-10, https://github.com/Azure/azure-cli/pull/8000). Currently we use scripts/release/debian/build.sh to build the DEB package.

rayluo commented 2 years ago

Thanks for the hint. But that scripts/release/debian/build.sh contains this line:

https://github.com/Azure/azure-cli/blob/azure-cli-2.35.0/scripts/release/debian/build.sh#L7

# This script is expected to be run in a container environment

What container shall I use to run that script?

Basically, if you can share with the steps to build a debian package (and ideally also update the Debian Packaging instruction accordingly), I can try to do this part for you to unblock the downstream team. Please help me to help you. :-)

jiasli commented 2 years ago

What container shall I use to run that script?

It should be run in Ubuntu or Debian container like

https://github.com/Azure/azure-cli/blob/1ecfb36bfa3bb578c0c8ced2bd112191ebb843fe/scripts/release/debian/pipeline.sh#L13-L21