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

[Ubuntu] Update Shell Script to Verify Azure CLI Availability #10126

Merged
merged 1 commit into from
Jul 29, 2024

Conversation

kishorekumar-anchala
Copy link
Contributor

@kishorekumar-anchala kishorekumar-anchala commented Jun 25, 2024

Description

This PR ensures that Azure CLI ('az') is installed and operational by attempting to retrieve its help information. If the command fails, it provides an error message and exits with a non-zero status, signaling a failure in Azure CLI availability.

Related issue:

10110

Check list

  • Related issue / work item is attached
  • Tests are written (if applicable)
  • Documentation is updated (if applicable)
  • Changes are tested and related VM images are successfully generated

@erik-bershel
Copy link
Contributor

/azp run ubuntu2004,ubuntu2204,ubuntu2404

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@erik-bershel
Copy link
Contributor

Hey @kishorekumar-anchala!
Take a look on the issue log. It's a bit more complicate than just one-time execution I suppose. With this realisation changes will never reach a runner because of a user profile deletion:

@ijunaidm ijunaidm merged commit fcf7cd1 into actions:main Jul 29, 2024
10 checks passed
@ijunaidm
Copy link
Contributor

/azp run ubuntu2004,ubuntu2204,ubuntu2404

ijunaidm added a commit that referenced this pull request Jul 29, 2024
kishorekumar-anchala added a commit to kishorekumar-anchala/runner-images-kishore that referenced this pull request Jul 29, 2024
ijunaidm pushed a commit that referenced this pull request Jul 29, 2024
@lanni-energinet
Copy link

@kishorekumar-anchala

Will this work? - It is an exact port of "images/windows/scripts/build/Install-AzureCli.ps1"

#!/bin/bash -e
################################################################################
##  File:  install-azure-cli.sh
##  Desc:  Install Azure CLI (az)
################################################################################

# Source the helpers for use with the script
source $HELPER_SCRIPTS/etc-environment.sh

export AZURE_CONFIG_DIR="/opt/az-config"
mkdir $AZURE_CONFIG_DIR
set_etc_environment_variable "AZURE_CONFIG_DIR" $AZURE_CONFIG_DIR

export AZURE_EXTENSION_DIR="/opt/az-extensions"
mkdir $AZURE_EXTENSION_DIR
set_etc_environment_variable "AZURE_EXTENSION_DIR" $AZURE_EXTENSION_DIR

# Install Azure CLI (instructions taken from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli)
curl -fsSL https://aka.ms/InstallAzureCLIDeb | sudo bash

echo "azure-cli https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt" >> $HELPER_SCRIPTS/apt-sources.txt

rm -f /etc/apt/sources.list.d/azure-cli.list
rm -f /etc/apt/sources.list.d/azure-cli.list.save

echo "Warmup 'az'"
az --help > /dev/null
if [ $? -ne 0 ]; then
    echo "Command 'az --help' failed"
    exit 1
fi

invoke_tests "CLI.Tools" "Azure CLI"

nikolai-in pushed a commit to nikolai-in/proxmox-runner-images that referenced this pull request Aug 1, 2024
nikolai-in pushed a commit to nikolai-in/proxmox-runner-images that referenced this pull request Aug 1, 2024
@kishorekumar-anchala kishorekumar-anchala deleted the az-cli-warmup branch August 8, 2024 05:48
@kishorekumar-anchala kishorekumar-anchala restored the az-cli-warmup branch August 21, 2024 13:31
Water-Melon pushed a commit to Kong/runner-images-kvm that referenced this pull request Sep 25, 2024
Water-Melon pushed a commit to Kong/runner-images-kvm that referenced this pull request Sep 25, 2024
@kishorekumar-anchala kishorekumar-anchala deleted the az-cli-warmup branch October 7, 2024 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants