-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'rc2.0.48' into master_branch
- Loading branch information
Showing
30 changed files
with
1,127 additions
and
827 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Debian Packaging | ||
================ | ||
|
||
Updating the Debian package | ||
--------------------------- | ||
|
||
On a build machine (e.g. new Ubuntu 14.04 VM), run the build script. | ||
|
||
For example: | ||
``` | ||
git clone https://github.com/azure/azure-cli | ||
cd azure-cli | ||
export CLI_VERSION=2.0.9 \ | ||
&& export BUILD_ARTIFACT_DIR=$(mktemp -d)\ | ||
&& build_scripts/debian/build.sh $(pwd) | ||
``` | ||
|
||
Note: The paths above have to be full paths, not relative otherwise the build will fail. | ||
|
||
Now you have built the package, upload the package to the apt repository. | ||
|
||
|
||
Verification | ||
------------ | ||
|
||
``` | ||
sudo dpkg -i azure-cli_${CLI_VERSION}-1_all.deb | ||
az | ||
az --version | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#!/usr/bin/env bash | ||
#--------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
#--------------------------------------------------------------------------------------------- | ||
|
||
set -ex | ||
|
||
: "${CLI_VERSION:?CLI_VERSION environment variable not set.}" | ||
: "${BUILD_ARTIFACT_DIR:?BUILD_ARTIFACT_DIR environment variable not set.}" | ||
|
||
if [ -z "$1" ] | ||
then | ||
echo "Argument should be path to local repo." | ||
exit 1 | ||
fi | ||
|
||
local_repo=$1 | ||
|
||
sudo apt-get update | ||
|
||
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
debian_directory_creator=$script_dir/dir_creator.sh | ||
|
||
# Install dependencies for the build | ||
sudo apt-get install -y libssl-dev libffi-dev python3-dev debhelper | ||
# Download, Extract, Patch, Build CLI | ||
tmp_pkg_dir=$(mktemp -d) | ||
working_dir=$(mktemp -d) | ||
cd $working_dir | ||
source_dir=$local_repo | ||
deb_file=$local_repo/../azure-cli_${CLI_VERSION}-${CLI_VERSION_REVISION:=1}_all.deb | ||
az_completion_file=$source_dir/az.completion | ||
# clean up old build output | ||
if [ -d "$source_dir/debian" ] | ||
then | ||
rm -rf $source_dir/debian | ||
fi | ||
[ -d $local_repo/privates ] && cp $local_repo/privates/*.whl $tmp_pkg_dir | ||
|
||
# Build Python from source and include | ||
python_dir=$(mktemp -d) | ||
python_archive=$(mktemp) | ||
wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz -qO $python_archive | ||
tar -xvzf $python_archive -C $python_dir | ||
echo "Python dir is $python_dir" | ||
# clean any previous make files | ||
make clean || echo "Nothing to clean" | ||
$python_dir/*/configure --srcdir $python_dir/* --prefix $source_dir/python_env | ||
make | ||
# required to run the 'make install' | ||
sudo apt-get install -y zlib1g-dev | ||
make install | ||
|
||
# note: This installation step could happen in debian/rules but was unable to escape $ char. | ||
# It does not affect the built .deb file though. | ||
$source_dir/python_env/bin/pip3 install wheel | ||
for d in $source_dir/src/azure-cli $source_dir/src/azure-cli-core $source_dir/src/azure-cli-nspkg \ | ||
$source_dir/src/azure-cli-command_modules-nspkg $source_dir/src/command_modules/azure-cli-*/; | ||
do cd $d; | ||
$source_dir/python_env/bin/python3 setup.py bdist_wheel -d $tmp_pkg_dir; | ||
cd -; | ||
done; | ||
all_modules=`find $tmp_pkg_dir -name "*.whl"` | ||
$source_dir/python_env/bin/pip3 install $all_modules | ||
$source_dir/python_env/bin/pip3 install --force-reinstall --upgrade azure-nspkg azure-mgmt-nspkg | ||
# Add the debian files | ||
mkdir $source_dir/debian | ||
# Create temp dir for the debian/ directory used for CLI build. | ||
cli_debian_dir_tmp=$(mktemp -d) | ||
|
||
$debian_directory_creator $cli_debian_dir_tmp $az_completion_file $source_dir | ||
cp -r $cli_debian_dir_tmp/* $source_dir/debian | ||
cd $source_dir | ||
dpkg-buildpackage -us -uc | ||
echo "The archive is available at $working_dir/azure-cli_${CLI_VERSION}-${CLI_VERSION_REVISION:=1}_all.deb" | ||
cp $deb_file ${BUILD_ARTIFACT_DIR} | ||
echo "The archive has also been copied to ${BUILD_ARTIFACT_DIR}" | ||
echo "Done." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
#!/usr/bin/env bash | ||
#--------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
#--------------------------------------------------------------------------------------------- | ||
|
||
set -ex | ||
|
||
# Create the debian/ directory for building the azure-cli Debian package | ||
|
||
# This script takes an argument of the empty directory where the files will be placed. | ||
|
||
if [ -z "$1" ] | ||
then | ||
echo "No argument supplied for debian directory." | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$2" ] | ||
then | ||
echo "No argument supplied for completion script." | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$3" ] | ||
then | ||
echo "No argument supplied for source directory." | ||
exit 1 | ||
fi | ||
|
||
TAB=$'\t' | ||
|
||
debian_dir=$1 | ||
completion_script=$2 | ||
source_dir=$3 | ||
mkdir $debian_dir/source | ||
|
||
echo '1.0' > $debian_dir/source/format | ||
echo '9' > $debian_dir/compat | ||
|
||
cat > $debian_dir/changelog <<- EOM | ||
azure-cli (${CLI_VERSION}-${CLI_VERSION_REVISION:=1}) unstable; urgency=low | ||
* Debian package release. | ||
-- Azure Python CLI Team <[email protected]> $(date -R) | ||
EOM | ||
|
||
cat > $debian_dir/control <<- EOM | ||
Source: azure-cli | ||
Section: python | ||
Priority: extra | ||
Maintainer: Azure Python CLI Team <[email protected]> | ||
Build-Depends: debhelper (>= 9), libssl-dev, libffi-dev, python3-dev | ||
Standards-Version: 3.9.5 | ||
Homepage: https://github.com/azure/azure-cli | ||
Package: azure-cli | ||
Architecture: all | ||
Depends: \${shlibs:Depends}, \${misc:Depends} | ||
Description: Azure CLI | ||
A great cloud needs great tools; we're excited to introduce Azure CLI, | ||
our next generation multi-platform command line experience for Azure. | ||
EOM | ||
|
||
cat > $debian_dir/copyright <<- EOM | ||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | ||
Upstream-Name: azure-cli | ||
Upstream-Contact: Azure Python CLI Team <[email protected]> | ||
Source: https://github.com/azure/azure-cli | ||
Files: * | ||
Copyright: Copyright (c) Microsoft Corporation | ||
License: MIT | ||
Azure CLI | ||
Copyright (c) Microsoft Corporation | ||
All rights reserved. | ||
MIT License | ||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
EOM | ||
|
||
# TODO: Instead of "_ssl.cpython-36m-x86_64-linux-gnu.so" only, find all .so files with "find debian/azure-cli/opt/az -type f -name '*.so'" | ||
|
||
cat > $debian_dir/rules << EOM | ||
#!/usr/bin/make -f | ||
# Uncomment this to turn on verbose mode. | ||
export DH_VERBOSE=1 | ||
export DH_OPTIONS=-v | ||
%: | ||
${TAB}dh \$@ --sourcedirectory $source_dir | ||
override_dh_install: | ||
${TAB}mkdir -p debian/azure-cli/opt/az | ||
${TAB}cp -a python_env/* debian/azure-cli/opt/az | ||
${TAB}mkdir -p debian/azure-cli/usr/bin/ | ||
${TAB}echo "\043!/usr/bin/env bash\n/opt/az/bin/python3 -Im azure.cli \"\044\100\"" > debian/azure-cli/usr/bin/az | ||
${TAB}chmod 0755 debian/azure-cli/usr/bin/az | ||
${TAB}mkdir -p debian/azure-cli/etc/bash_completion.d/ | ||
${TAB}cat ${completion_script} > debian/azure-cli/etc/bash_completion.d/azure-cli | ||
${TAB}dpkg-shlibdeps -v --warnings=7 -Tdebian/azure-cli.substvars -dDepends -edebian/azure-cli/opt/az/bin/python3 debian/azure-cli/opt/az/lib/python3.6/lib-dynload/_ssl.cpython-36m-x86_64-linux-gnu.so | ||
override_dh_strip: | ||
${TAB}dh_strip --exclude=_cffi_backend | ||
EOM | ||
|
||
cat $debian_dir/rules | ||
|
||
# debian/rules should be executable | ||
chmod 0755 $debian_dir/rules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
Docker Packaging | ||
================ | ||
|
||
The Docker image is available at https://hub.docker.com/r/microsoft/azure-cli/tags/. | ||
|
||
Updating the Docker image | ||
------------------------- | ||
1. Run `docker build` with the Dockerfile. | ||
When tagging this Docker image, choose an appropriate version number. | ||
e.g.: ``sudo docker build --no-cache --build-arg BUILD_DATE="`date -u +"%Y-%m-%dT%H:%M:%SZ"`" --build-arg CLI_VERSION=${CLI_VERSION} -f Dockerfile -t microsoft/azure-cli:${CLI_VERSION} .`` | ||
2. Push the image to the registry, | ||
e.g.: `sudo docker push microsoft/azure-cli:${CLI_VERSION}` | ||
3. Create a PR to commit the Dockerfile changes back to the repository. | ||
|
||
|
||
Verification | ||
------------ | ||
|
||
Run the image. | ||
|
||
``` | ||
$ docker run -it microsoft/azure-cli:${CLI_VERSION} | ||
$ az | ||
$ az --version | ||
``` | ||
|
||
Save the image | ||
``` | ||
docker save -o docker-microsoft-azure-cli-VERSION.tar microsoft/azure-cli:${CLI_VERSION} | ||
``` | ||
|
||
Load the saved image | ||
``` | ||
docker load -i docker-microsoft-azure-cli-VERSION.tar | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
Homebrew Packaging | ||
================== | ||
|
||
|
||
Updating the formula | ||
-------------------- | ||
1. Change the `url` in the formula to point to the new release and change the `sha256` value also. | ||
2. Update the resources list in the formula (see below). | ||
3. Run the formula verification commands (see below). | ||
4. Submit a PR to https://github.com/Homebrew/homebrew-core. | ||
|
||
|
||
Updating the resources list | ||
--------------------------- | ||
``` | ||
# Create a new virtual environment first | ||
pip install azure-cli homebrew-pypi-poet; poet -r azure-cli | ||
``` | ||
|
||
Verification | ||
------------ | ||
|
||
``` | ||
brew install --build-from-source azure-cli.rb | ||
brew test azure-cli.rb | ||
brew audit --strict --online azure-cli.rb | ||
``` | ||
|
||
More Information | ||
---------------- | ||
https://github.com/Homebrew/homebrew-core/blob/master/CONTRIBUTING.md | ||
|
||
https://github.com/Homebrew/brew/blob/master/docs/Formula-Cookbook.md | ||
|
||
https://github.com/Homebrew/brew/blob/master/docs/Acceptable-Formulae.md |
Oops, something went wrong.