Skip to content

Commit 9fd6b4f

Browse files
authored
{C} Use Azure Artifacts feeds in release branch (Azure#29866)
1 parent 6443216 commit 9fd6b4f

File tree

6 files changed

+46
-2
lines changed

6 files changed

+46
-2
lines changed

azure-pipelines.yml

+33
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ trigger:
66
branches:
77
include:
88
- '*'
9+
exclude:
10+
- 'release'
911

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

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

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

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

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

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

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

739+
- task: PipAuthenticate@1
740+
condition: eq(variables['Build.SourceBranch'], 'refs/heads/release')
741+
displayName: 'Pip Authenticate'
742+
inputs:
743+
artifactFeeds: $(AZURE_ARTIFACTS_FEEDS)
744+
722745
- task: Bash@3
723746
displayName: 'Build Rpm Package: Azure Linux'
724747
inputs:
@@ -809,6 +832,11 @@ jobs:
809832
steps:
810833
- bash: ./scripts/ci/install_docker.sh
811834
displayName: Install Docker
835+
- task: PipAuthenticate@1
836+
condition: eq(variables['Build.SourceBranch'], 'refs/heads/release')
837+
displayName: 'Pip Authenticate'
838+
inputs:
839+
artifactFeeds: $(AZURE_ARTIFACTS_FEEDS)
812840
- task: Bash@3
813841
displayName: 'Build Rpm Package'
814842
inputs:
@@ -926,6 +954,11 @@ jobs:
926954
steps:
927955
- bash: ./scripts/ci/install_docker.sh
928956
displayName: Install Docker
957+
- task: PipAuthenticate@1
958+
condition: eq(variables['Build.SourceBranch'], 'refs/heads/release')
959+
displayName: 'Pip Authenticate'
960+
inputs:
961+
artifactFeeds: $(AZURE_ARTIFACTS_FEEDS)
929962
- task: Bash@3
930963
displayName: 'Build $(deb_system) $(distro) $(arch) Package'
931964
inputs:

scripts/release/debian/pipeline.sh

+1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ docker run --rm \
1717
-e CLI_VERSION=$CLI_VERSION \
1818
-e CLI_VERSION_REVISION=1~$DISTRO \
1919
-e DEBIAN_FRONTEND=noninteractive \
20+
-e PIP_INDEX_URL=$PIP_INDEX_URL \
2021
$DISTRO_BASE_IMAGE \
2122
/mnt/repo/scripts/release/debian/build.sh

scripts/release/rpm/azurelinux.dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ COPY . .
2222
# Azure Linux 3's python3 is 3.12, the rpm paths are
2323
# /usr/src/azl/RPMS/x86_64/azure-cli-2.63.0-1.azl3.x86_64.rpm
2424
# /usr/src/azl/RPMS/aarch64/azure-cli-2.63.0-1.azl3.aarch64.rpm
25-
RUN dos2unix ./scripts/release/rpm/azure-cli.spec && \
25+
RUN --mount=type=secret,id=PIP_INDEX_URL export PIP_INDEX_URL=$(cat /run/secrets/PIP_INDEX_URL) && \
26+
dos2unix ./scripts/release/rpm/azure-cli.spec && \
2627
REPO_PATH=$(pwd) CLI_VERSION=$cli_version PYTHON_PACKAGE=python3 PYTHON_CMD=python3 \
2728
rpmbuild -v -bb --clean scripts/release/rpm/azure-cli.spec && \
2829
cp /usr/src/*/RPMS/*/azure-cli-${cli_version}-1.*.rpm /azure-cli-dev.rpm && \

scripts/release/rpm/pipeline.sh

+4
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ set -exv
1515

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

18+
# PIP_INDEX_URL env must exist in `docker build --secret`, use an empty string if it doesn't exist.
19+
export PIP_INDEX_URL=${PIP_INDEX_URL}
20+
1821
# Create a container image that includes the source code and a built RPM using this file.
1922
docker build \
2023
--target build-env \
2124
--build-arg cli_version=${CLI_VERSION} \
2225
--build-arg image=${IMAGE} \
2326
--build-arg python_package=${PYTHON_PACKAGE} \
27+
--secret id=PIP_INDEX_URL \
2428
-f ./scripts/release/rpm/${DOCKERFILE}.dockerfile \
2529
-t azure/azure-cli:${DOCKERFILE}-builder \
2630
.

scripts/release/rpm/pipeline_azurelinux.sh

+4
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@ set -exv
1111

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

14+
# PIP_INDEX_URL env must exist in `docker build --secret`, use an empty string if it doesn't exist.
15+
export PIP_INDEX_URL=${PIP_INDEX_URL}
16+
1417
# Create a container image that includes the source code and a built RPM using this file.
1518
docker build \
1619
--target build-env \
1720
--build-arg cli_version=${CLI_VERSION} \
1821
--build-arg image=${IMAGE} \
22+
--secret id=PIP_INDEX_URL \
1923
-f ./scripts/release/rpm/azurelinux.dockerfile \
2024
-t azure/azure-cli:azurelinux-builder \
2125
.

scripts/release/rpm/ubi.dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ COPY . .
1616

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

0 commit comments

Comments
 (0)