Skip to content

Commit

Permalink
{C} Use Azure Artifacts feeds in release branch (#29866)
Browse files Browse the repository at this point in the history
bebound authored Oct 16, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 6443216 commit 9fd6b4f
Showing 6 changed files with 46 additions and 2 deletions.
33 changes: 33 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -6,6 +6,8 @@ trigger:
branches:
include:
- '*'
exclude:
- 'release'

pr:
branches:
@@ -205,6 +207,11 @@ jobs:
TargetPath: '$(Build.ArtifactStagingDirectory)/metadata'
artifactName: metadata

- task: PipAuthenticate@1
condition: eq(variables['Build.SourceBranch'], 'refs/heads/release')
displayName: 'Pip Authenticate'
inputs:
artifactFeeds: $(AZURE_ARTIFACTS_FEEDS)

- script: |
set ARCH=$(Platform)
@@ -244,6 +251,11 @@ jobs:
TargetPath: '$(Build.ArtifactStagingDirectory)/metadata'
artifactName: metadata

- task: PipAuthenticate@1
condition: eq(variables['Build.SourceBranch'], 'refs/heads/release')
displayName: 'Pip Authenticate'
inputs:
artifactFeeds: $(AZURE_ARTIFACTS_FEEDS)

- script: |
set ARCH=$(Platform)
@@ -429,6 +441,11 @@ jobs:
inputs:
versionSpec: 3.11

- task: PipAuthenticate@1
condition: eq(variables['Build.SourceBranch'], 'refs/heads/release')
displayName: 'Pip Authenticate'
inputs:
artifactFeeds: $(AZURE_ARTIFACTS_FEEDS)

- script: |
if [[ "$(Build.Reason)" == "PullRequest" ]]; then
@@ -719,6 +736,12 @@ jobs:
- bash: ./scripts/ci/install_docker.sh
displayName: Install Docker

- task: PipAuthenticate@1
condition: eq(variables['Build.SourceBranch'], 'refs/heads/release')
displayName: 'Pip Authenticate'
inputs:
artifactFeeds: $(AZURE_ARTIFACTS_FEEDS)

- task: Bash@3
displayName: 'Build Rpm Package: Azure Linux'
inputs:
@@ -809,6 +832,11 @@ jobs:
steps:
- bash: ./scripts/ci/install_docker.sh
displayName: Install Docker
- task: PipAuthenticate@1
condition: eq(variables['Build.SourceBranch'], 'refs/heads/release')
displayName: 'Pip Authenticate'
inputs:
artifactFeeds: $(AZURE_ARTIFACTS_FEEDS)
- task: Bash@3
displayName: 'Build Rpm Package'
inputs:
@@ -926,6 +954,11 @@ jobs:
steps:
- bash: ./scripts/ci/install_docker.sh
displayName: Install Docker
- task: PipAuthenticate@1
condition: eq(variables['Build.SourceBranch'], 'refs/heads/release')
displayName: 'Pip Authenticate'
inputs:
artifactFeeds: $(AZURE_ARTIFACTS_FEEDS)
- task: Bash@3
displayName: 'Build $(deb_system) $(distro) $(arch) Package'
inputs:
1 change: 1 addition & 0 deletions scripts/release/debian/pipeline.sh
Original file line number Diff line number Diff line change
@@ -17,5 +17,6 @@ docker run --rm \
-e CLI_VERSION=$CLI_VERSION \
-e CLI_VERSION_REVISION=1~$DISTRO \
-e DEBIAN_FRONTEND=noninteractive \
-e PIP_INDEX_URL=$PIP_INDEX_URL \
$DISTRO_BASE_IMAGE \
/mnt/repo/scripts/release/debian/build.sh
3 changes: 2 additions & 1 deletion scripts/release/rpm/azurelinux.dockerfile
Original file line number Diff line number Diff line change
@@ -22,7 +22,8 @@ COPY . .
# Azure Linux 3's python3 is 3.12, the rpm paths are
# /usr/src/azl/RPMS/x86_64/azure-cli-2.63.0-1.azl3.x86_64.rpm
# /usr/src/azl/RPMS/aarch64/azure-cli-2.63.0-1.azl3.aarch64.rpm
RUN dos2unix ./scripts/release/rpm/azure-cli.spec && \
RUN --mount=type=secret,id=PIP_INDEX_URL export PIP_INDEX_URL=$(cat /run/secrets/PIP_INDEX_URL) && \
dos2unix ./scripts/release/rpm/azure-cli.spec && \
REPO_PATH=$(pwd) CLI_VERSION=$cli_version PYTHON_PACKAGE=python3 PYTHON_CMD=python3 \
rpmbuild -v -bb --clean scripts/release/rpm/azure-cli.spec && \
cp /usr/src/*/RPMS/*/azure-cli-${cli_version}-1.*.rpm /azure-cli-dev.rpm && \
4 changes: 4 additions & 0 deletions scripts/release/rpm/pipeline.sh
Original file line number Diff line number Diff line change
@@ -15,12 +15,16 @@ set -exv

CLI_VERSION=`cat src/azure-cli/azure/cli/__main__.py | grep __version__ | sed s/' '//g | sed s/'__version__='// | sed s/\"//g`

# PIP_INDEX_URL env must exist in `docker build --secret`, use an empty string if it doesn't exist.
export PIP_INDEX_URL=${PIP_INDEX_URL}

# Create a container image that includes the source code and a built RPM using this file.
docker build \
--target build-env \
--build-arg cli_version=${CLI_VERSION} \
--build-arg image=${IMAGE} \
--build-arg python_package=${PYTHON_PACKAGE} \
--secret id=PIP_INDEX_URL \
-f ./scripts/release/rpm/${DOCKERFILE}.dockerfile \
-t azure/azure-cli:${DOCKERFILE}-builder \
.
4 changes: 4 additions & 0 deletions scripts/release/rpm/pipeline_azurelinux.sh
Original file line number Diff line number Diff line change
@@ -11,11 +11,15 @@ set -exv

CLI_VERSION=`cat src/azure-cli/azure/cli/__main__.py | grep __version__ | sed s/' '//g | sed s/'__version__='// | sed s/\"//g`

# PIP_INDEX_URL env must exist in `docker build --secret`, use an empty string if it doesn't exist.
export PIP_INDEX_URL=${PIP_INDEX_URL}

# Create a container image that includes the source code and a built RPM using this file.
docker build \
--target build-env \
--build-arg cli_version=${CLI_VERSION} \
--build-arg image=${IMAGE} \
--secret id=PIP_INDEX_URL \
-f ./scripts/release/rpm/azurelinux.dockerfile \
-t azure/azure-cli:azurelinux-builder \
.
3 changes: 2 additions & 1 deletion scripts/release/rpm/ubi.dockerfile
Original file line number Diff line number Diff line change
@@ -16,7 +16,8 @@ COPY . .

# RHEL 8's 'python3' is Python 3.6. RHEL 9's 'python3' is Python 3.9.
# We have to explicitly specify 'python39' to install Python 3.9.
RUN dos2unix ./scripts/release/rpm/azure-cli.spec && \
RUN --mount=type=secret,id=PIP_INDEX_URL export PIP_INDEX_URL=$(cat /run/secrets/PIP_INDEX_URL) && \
dos2unix ./scripts/release/rpm/azure-cli.spec && \
REPO_PATH=$(pwd) CLI_VERSION=$cli_version PYTHON_PACKAGE=$python_package PYTHON_CMD=python3.9 \
rpmbuild -v -bb --clean scripts/release/rpm/azure-cli.spec && \
cp /root/rpmbuild/RPMS/*/azure-cli-${cli_version}-1.*.rpm /azure-cli-dev.rpm && \

0 comments on commit 9fd6b4f

Please sign in to comment.