Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{Packaging} Use deb822 format in DEB installation script #28250

Merged
merged 8 commits into from
May 8, 2024

Conversation

konstruktoid
Copy link
Contributor

Description

This PR:

This checklist is used to make sure that common guidelines for a pull request are followed.

Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
Copy link

azure-client-tools-bot-prd bot commented Jan 25, 2024

️✔️AzureCLI-FullTest
️✔️acr
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️acs
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️advisor
️✔️latest
️✔️3.11
️✔️3.9
️✔️ams
️✔️latest
️✔️3.11
️✔️3.9
️✔️apim
️✔️latest
️✔️3.11
️✔️3.9
️✔️appconfig
️✔️latest
️✔️3.11
️✔️3.9
️✔️appservice
️✔️latest
️✔️3.11
️✔️3.9
️✔️aro
️✔️latest
️✔️3.11
️✔️3.9
️✔️backup
️✔️latest
️✔️3.11
️✔️3.9
️✔️batch
️✔️latest
️✔️3.11
️✔️3.9
️✔️batchai
️✔️latest
️✔️3.11
️✔️3.9
️✔️billing
️✔️latest
️✔️3.11
️✔️3.9
️✔️botservice
️✔️latest
️✔️3.11
️✔️3.9
️✔️cdn
️✔️latest
️✔️3.11
️✔️3.9
️✔️cloud
️✔️latest
️✔️3.11
️✔️3.9
️✔️cognitiveservices
️✔️latest
️✔️3.11
️✔️3.9
️✔️compute_recommender
️✔️latest
️✔️3.11
️✔️3.9
️✔️config
️✔️latest
️✔️3.11
️✔️3.9
️✔️configure
️✔️latest
️✔️3.11
️✔️3.9
️✔️consumption
️✔️latest
️✔️3.11
️✔️3.9
️✔️container
️✔️latest
️✔️3.11
️✔️3.9
️✔️containerapp
️✔️latest
️✔️3.11
️✔️3.9
️✔️core
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️cosmosdb
️✔️latest
️✔️3.11
️✔️3.9
️✔️databoxedge
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️dla
️✔️latest
️✔️3.11
️✔️3.9
️✔️dls
️✔️latest
️✔️3.11
️✔️3.9
️✔️dms
️✔️latest
️✔️3.11
️✔️3.9
️✔️eventgrid
️✔️latest
️✔️3.11
️✔️3.9
️✔️eventhubs
️✔️latest
️✔️3.11
️✔️3.9
️✔️feedback
️✔️latest
️✔️3.11
️✔️3.9
️✔️find
️✔️latest
️✔️3.11
️✔️3.9
️✔️hdinsight
️✔️latest
️✔️3.11
️✔️3.9
️✔️identity
️✔️latest
️✔️3.11
️✔️3.9
️✔️iot
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️keyvault
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️kusto
️✔️latest
️✔️3.11
️✔️3.9
️✔️lab
️✔️latest
️✔️3.11
️✔️3.9
️✔️managedservices
️✔️latest
️✔️3.11
️✔️3.9
️✔️maps
️✔️latest
️✔️3.11
️✔️3.9
️✔️marketplaceordering
️✔️latest
️✔️3.11
️✔️3.9
️✔️monitor
️✔️latest
️✔️3.11
️✔️3.9
️✔️mysql
️✔️latest
️✔️3.11
️✔️3.9
️✔️netappfiles
️✔️latest
️✔️3.11
️✔️3.9
️✔️network
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️policyinsights
️✔️latest
️✔️3.11
️✔️3.9
️✔️privatedns
️✔️latest
️✔️3.11
️✔️3.9
️✔️profile
️✔️latest
️✔️3.11
️✔️3.9
️✔️rdbms
️✔️latest
️✔️3.11
️✔️3.9
️✔️redis
️✔️latest
️✔️3.11
️✔️3.9
️✔️relay
️✔️latest
️✔️3.11
️✔️3.9
️✔️resource
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️role
️✔️latest
️✔️3.11
️✔️3.9
️✔️search
️✔️latest
️✔️3.11
️✔️3.9
️✔️security
️✔️latest
️✔️3.11
️✔️3.9
️✔️servicebus
️✔️latest
️✔️3.11
️✔️3.9
️✔️serviceconnector
️✔️latest
️✔️3.11
️✔️3.9
️✔️servicefabric
️✔️latest
️✔️3.11
️✔️3.9
️✔️signalr
️✔️latest
️✔️3.11
️✔️3.9
️✔️sql
️✔️latest
️✔️3.11
️✔️3.9
️✔️sqlvm
️✔️latest
️✔️3.11
️✔️3.9
️✔️storage
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️synapse
️✔️latest
️✔️3.11
️✔️3.9
️✔️telemetry
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️util
️✔️latest
️✔️3.11
️✔️3.9
️✔️vm
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9

Copy link

Hi @konstruktoid,
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

Copy link

azure-client-tools-bot-prd bot commented Jan 25, 2024

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

@yonzhan
Copy link
Collaborator

yonzhan commented Jan 25, 2024

Thank you for your contribution! We will review the pull request and get back to you soon.

@microsoft-github-policy-service microsoft-github-policy-service bot added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Jan 25, 2024
@konstruktoid konstruktoid changed the title use deb822 format when using apt for installation {Packaging} use deb822 format when using apt for installation Jan 25, 2024
@konstruktoid
Copy link
Contributor Author

/retest

@bebound bebound changed the title {Packaging} use deb822 format when using apt for installation {Packaging} Use deb822 format in DEB installation script Feb 19, 2024
@bebound
Copy link
Contributor

bebound commented Feb 19, 2024

This is the script I used for testing:

# download deb_install.sh to current directory
CLI_VERSION="2.57.0"
images=("ubuntu:18.04" "ubuntu:20.04" "ubuntu:22.04" "debian:10" "debian:11" "debian:12")
for image in "${images[@]}"; do
  echo "testing $image"
  docker run -v `pwd`/deb_install.sh:/deb_install.sh  --rm $image bash -c "bash /deb_install.sh && az version | grep $CLI_VERSION"
  if [ $? -ne 0 ]; then
    echo test failed in $image
    exit 1
  fi
done

konstruktoid and others added 4 commits February 19, 2024 10:03
Co-authored-by: Hang <bebound@gmail.com>
Co-authored-by: Hang <bebound@gmail.com>
Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
@konstruktoid
Copy link
Contributor Author

#28250 (comment)
I rewrote it a bit, but should this be added (in another PR) as a test script? It's kind of convenient to have.

#!/bin/bash
CLI_VERSION="2.57.0"

set -euo pipefail

# use deb_install.sh in current directry
images=("ubuntu:18.04" "ubuntu:20.04" "ubuntu:22.04" "debian:10" "debian:11" "debian:12")

for image in "${images[@]}"; do
  echo "Testing ${image}"
  docker run -v "$(pwd)/deb_install.sh:/deb_install.sh" --rm "${image}" bash -c "bash /deb_install.sh"
  if ! az version | grep "\"azure-cli\": \"${CLI_VERSION}\""; then
    echo "Test failed in ${image}"
    exit 1
  fi
done

Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
@bebound
Copy link
Contributor

bebound commented Feb 20, 2024

#28250 (comment) I rewrote it a bit, but should this be added (in another PR) as a test script? It's kind of convenient to have.

#!/bin/bash
CLI_VERSION="2.57.0"

set -euo pipefail

# use deb_install.sh in current directry
images=("ubuntu:18.04" "ubuntu:20.04" "ubuntu:22.04" "debian:10" "debian:11" "debian:12")

for image in "${images[@]}"; do
  echo "Testing ${image}"
  docker run -v "$(pwd)/deb_install.sh:/deb_install.sh" --rm "${image}" bash -c "bash /deb_install.sh"
  if ! az version | grep "\"azure-cli\": \"${CLI_VERSION}\""; then
    echo "Test failed in ${image}"
    exit 1
  fi
done

az version and the subsequent commands need to be run inside docker. Otherwise, we're calling the local az.

I don't have a preference regarding adding it to the repo. @jiasli, what's your opinion?

PS: deb822 is supported by apt since version 1.1, making it compatible with Ubuntu 16.04, Debian 9 and later.

@konstruktoid
Copy link
Contributor Author

Yeah, it was more of a concept, if it was worth spending time on.

@@ -42,12 +42,15 @@ setup() {
set -v
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y apt-transport-https lsb-release gnupg curl
apt-get install --assume-yes --no-install-recommends apt-transport-https ca-certificates curl gnupg lsb-release
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is ca-certificates required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's specified in https://github.com/konstruktoid/azure-docs-cli/blob/main/docs-ref-conceptual/includes/cli-install-linux-apt.md#option-2-step-by-step-installation-instructions, and (needed or not) most often included in installation scripts just-in-case, just as gnupg and curl that tends to be installed by default as well.

scripts/release/debian/deb_install.sh Outdated Show resolved Hide resolved
Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
@bebound bebound merged commit 655b05b into Azure:dev May 8, 2024
54 checks passed
@konstruktoid konstruktoid deleted the deb822 branch May 8, 2024 06:03
Suites: ${CLI_REPO}
Components: main
Architectures: $(dpkg --print-architecture)
Signed-by: /etc/apt/keyrings/microsoft.gpg" | tee /etc/apt/sources.list.d/azure-cli.sources
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This /etc/apt/sources.list.d/azure-cli.list -> /etc/apt/sources.list.d/azure-cli.sources renaming breaks the logic of check_distro_consistency from #5755:

LIST_FILE_PATH = os.path.join(os.sep, 'etc', 'apt', 'sources.list.d', 'azure-cli.list')

def check_distro_consistency():
if IS_WINDOWS:
return
try:
logger.debug('Linux distro check: Reading from: %s', LIST_FILE_PATH)
with open(LIST_FILE_PATH, 'r') as list_file:
package_source = list_file.read()
stored_linux_dist_name = package_source.split(" ")[3]
logger.debug('Linux distro check: Found in list file: %s', stored_linux_dist_name)
current_linux_dist_name = get_lsb_release()
logger.debug('Linux distro check: Reported by API: %s', current_linux_dist_name)
except Exception as err: # pylint: disable=broad-except
current_linux_dist_name = None
stored_linux_dist_name = None
logger.debug('Linux distro check: An error occurred while checking '
'linux distribution version source list consistency.')
logger.debug(err)
if current_linux_dist_name != stored_linux_dist_name:
logger.debug("Linux distro check: Mismatch distribution "
"name in %s file", LIST_FILE_PATH)
logger.debug("Linux distro check: If command fails, install the appropriate package "
"for your distribution or change the above file accordingly.")
logger.debug("Linux distro check: %s has '%s', current distro is '%s'",
LIST_FILE_PATH, stored_linux_dist_name, current_linux_dist_name)

and result in error in debug log:

cli.azure.cli.core.extension.operations: [Errno 2] No such file or directory: '/etc/apt/sources.list.d/azure-cli.list'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants