Skip to content

Commit

Permalink
Allow default python3 to be installed (#1)
Browse files Browse the repository at this point in the history
* Allow default python3 to be installed

* Fixing github action to use v4 instead of 4

* Supressing linter for downloading, unsure how to fix

* Adding README with intent

* Github action check runs with MacOS

* Added build badges
  • Loading branch information
boris-ning-usds authored Nov 19, 2023
1 parent 27d8555 commit b3bc0dc
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 32 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: Lint
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
paths:
- "bin/*"
push:
- ".github/workflows/*"
pull_request:
paths:
- "bin/*"

Expand All @@ -13,8 +16,8 @@ jobs:
name: shellcheck & shfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: luizm/action-sh-checker@v0.5.0
- uses: actions/checkout@v4
- uses: luizm/action-sh-checker@v0.8.0
env:
SHELLCHECK_OPTS: --external-sources
SHFMT_OPTS: -d -i 2 -ci
28 changes: 22 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,40 @@
name: CI
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
paths:
- "bin/*"
push:
- ".github/workflows/*"
pull_request:
paths:
- "bin/*"
schedule:
- cron: "0 0 * * *"
- ".github/workflows/*"

jobs:
plugin_test:
name: asdf plugin test
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os:
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.os }}
env:
PYTHON_TO_NOT_USE: "3.12"
steps:
- uses: asdf-vm/actions/plugin-test@v1
- name: Install extras
if: ${{ matrix.os == 'macos-latest'}}
run: |
sudo rm -rf "/Library/Frameworks/Python.framework/Versions/${PYTHON_TO_NOT_USE}"
sudo rm -rf "/Applications/Python ${PYTHON_TO_NOT_USE}"
sudo find /usr/local/bin -lname '../../../Library/Frameworks/Python.framework/Versions/${PYTHON_TO_NOT_USE}/*' -delete
brew link --force [email protected]
hash -r
python3 --version
- uses: asdf-vm/actions/plugin-test@v3
with:
command: az version
env:
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2022 https://github.com/itspngu
Copyright (c) 2023 https://github.com/boris-ning-usds

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
Expand Down
37 changes: 23 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# asdf-azure-cli ![CI](https://github.com/itspngu/asdf-azure-cli/workflows/CI/badge.svg) ![Lint](https://github.com/itspngu/asdf-azure-cli/workflows/Lint/badge.svg)
# asdf-azure-cli

[azure-cli](https://github.com/Azure/azure-cli) plugin for the [asdf version manager](https://asdf-vm.com).
![CI](https://github.com/boris-ning-usds/asdf-azure-cli/workflows/CI/badge.svg)
![Lint](https://github.com/boris-ning-usds/asdf-azure-cli/workflows/Lint/badge.svg)
[![License](https://img.shields.io/badge/License-BSD_0--Clause-orange.svg)](https://choosealicense.com/licenses/0bsd/)
[![Doc](https://img.shields.io/badge/Doc-asdf-blue)](https://asdf-vm.com/)

## ARCHIVAL NOTICE
Forked and modified from [itspngu](https://github.com/itspngu/asdf-azure-cli) as the project has been archived.

I stopped using asdf-vm and archived this repository. If you're using this plugin, please consider forking the repository and having it added to the upstream plugin list at https://github.com/asdf-vm/asdf-plugins.
This repository is a [azure-cli](https://github.com/Azure/azure-cli) plugin for the [asdf version manager](https://asdf-vm.com). [asdf plugin](https://github.com/asdf-vm/asdf-plugins) is a convenient way to install a large number of command line tools of various versions and to upgrade with a [flat-file](https://asdf-vm.com/manage/configuration.html#tool-versions).

## Contents

Expand All @@ -15,38 +18,44 @@ I stopped using asdf-vm and archived this repository. If you're using this plugi
## Plugin Dependencies

- `curl` - for azure-cli downloads from upstream releases
- `python3` (with `pip` and `venv` modules) - for installing and running the cli
- `python3` (with `pip` and `venv` modules) - for installing and running the cli where [version 2.54.0 release supports python 3.11](https://github.com/MicrosoftDocs/azure-docs-cli/blob/main/docs-ref-conceptual/release-notes-azure-cli.md#packaging).

## Install

Plugin:

```shell_session
$ asdf plugin-add azure-cli https://github.com/itspngu/asdf-azure-cli
```bash
asdf plugin-add azure-cli https://github.com/boris-ning-usds/asdf-azure-cli
```

azure-cli:

```shell_session
```bash
# Show all installable versions
$ asdf list-all azure-cli
asdf list-all azure-cli

# Install specific version
$ asdf install azure-cli latest
asdf install azure-cli latest

# Set a version globally (in your ~/.tool-versions file)
$ asdf global azure-cli latest
asdf global azure-cli latest

# Run azure-cli
$ az --version
azure-cli 2.32.0
az --version
> azure-cli 2.54.0
[...]
```

Refer to the [upstream azure-cli repository](https://github.com/Azure/azure-cli) for documentation and usage instructions.

Check the [asdf](https://github.com/asdf-vm/asdf) readme for more instructions on how to install & manage versions.

## Uninstall

```bash
asdf plguin remove azure-cli
```

## License

See [LICENSE](LICENSE)
See [LICENSE](LICENSE).
18 changes: 16 additions & 2 deletions bin/install
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,24 @@ source "$(dirname "$0")/lib"
install() {
if [ ! -d "$ASDF_DOWNLOAD_PATH" ]; then
# shellcheck source=SCRIPTDIR/download
source "$(dirname "$0")/download" || (
# shellcheck disable=SC2317
if source "$(dirname "$0")/download"; then
echo "azure-cli $ASDF_INSTALL_VERSION downloaded successfully"
else
echo "Downloading azure-cli $ASDF_INSTALL_VERSION failed" 1>&2
exit 1
)
fi
fi

## Azure CLI has a hard requirement on python3
## If the user already has python3, use their version
## Otherwise, install it for them as best effort
SUPPORTED_PYTHON_VERSION="3.11.6"
if command -v python3 >/dev/null 2>&1; then
echo "python3 already installed"
else
echo "python3 not installed! Installing python ${SUPPORTED_PYTHON_VERSION}..."
asdf install python "${SUPPORTED_PYTHON_VERSION}"
fi

mkdir -p "$ASDF_INSTALL_PATH/bin" &&
Expand Down
5 changes: 0 additions & 5 deletions bin/list-all
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
source "$(dirname "$0")/lib"

list_all() {
# Somebody, somewhere, makes the asdf-plugin-test action fail if it doesn't find
# shellcheck disable=SC2154
echo "'Authorization: token $GITHUB_API_TOKEN'" >/dev/null
# in this file, so enjoy your auth header, I'll keep the function where it is :P

curl -fsSL "https://pypi.org/simple/$(get_package_name)" |
sed -En -e "s;.*<a.*>$(get_package_name)-([0-9]+.[0-9]+.[0-9]+)-py3-none-any.whl</a.*;\1;p" |
sort_versions | paste -sd ' ' -
Expand Down

0 comments on commit b3bc0dc

Please sign in to comment.