Skip to content

Commit 3587366

Browse files
authored
Upgrade packages at image build time (#504)
* upgrade packages at image build time * update pipeline to use MCR * use mcr * use mcr * use mcr * use mcr * use mcr * use mcr * env * env * update pipeline * update pipeline * update pipeline * update pipeline * update pipeline * update pipeline * update pipeline * update pipeline * update pipeline * update pipeline * update pipelines * update pipelines * update pipelines
1 parent b18584d commit 3587366

File tree

4 files changed

+28
-13
lines changed

4 files changed

+28
-13
lines changed

.pipelines/e2e-step-template.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ steps:
6868
echo CNI type is $CNI_TYPE
6969
cat '${{ parameters.clusterDefinition }}' | jq --arg cnikey $CNI_TYPE --arg cniurl $CNI_URL '.properties.orchestratorProfile.kubernetesConfig[$cnikey]= $cniurl' > '${{ parameters.clusterDefinition }}'.tmp #
7070
cat '${{ parameters.clusterDefinition }}'.tmp | jq --arg tag $(Tag) '.properties.orchestratorProfile.kubernetesConfig.azureCNIVersion = $tag' > '${{ parameters.clusterDefinition }}'
71-
cat '${{ parameters.clusterDefinition }}' | jq --arg npmimage containernetworking/azure-npm:$(Tag) '.properties.orchestratorProfile.kubernetesConfig.addons[0].containers[0].image = $npmimage' > '${{ parameters.clusterDefinition }}'.tmp
71+
cat '${{ parameters.clusterDefinition }}' | jq --arg npmimage $PULL_CONTAINER_REGISTRY/azure-npm:$(Tag)-test '.properties.orchestratorProfile.kubernetesConfig.addons[0].containers[0].image = $npmimage' > '${{ parameters.clusterDefinition }}'.tmp
7272
mv '${{ parameters.clusterDefinition }}'.tmp '${{ parameters.clusterDefinition }}'
7373
echo "Running E2E tests against a cluster built with the following API model:"
7474
cat '${{ parameters.clusterDefinition }}'
@@ -101,9 +101,11 @@ steps:
101101
mkdir -p $(Build.ArtifactStagingDirectory)/kube-${{ parameters.name }}
102102
cp -r _output/k*/kubeconfig/kubeconfig.$REGIONS.json $(Build.ArtifactStagingDirectory)/kube-${{ parameters.name }}
103103
cp -r _output/kubernetes-*-ssh $(Build.ArtifactStagingDirectory)/kube-${{ parameters.name }}
104+
cp -r test/e2e/kubernetes/junit.xml $(Build.ArtifactStagingDirectory)/kube-${{ parameters.name }}
104105
name: CopyKubeConfigsAKSEngine
105106
displayName: Save cluster configs
106107
workingDirectory: "$(modulePath)"
108+
condition: always()
107109
108110
- task: PublishBuildArtifacts@1
109111
inputs:

.pipelines/pipeline.yaml

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,15 @@ stages:
5050
5151
- script: |
5252
echo "##vso[task.setvariable variable=CommitHash;isOutput=true]$(git rev-parse HEAD)"
53+
echo "##vso[task.setvariable variable=Tag;isOutput=true]$(git describe --tags --always --dirty)"
5354
export BRANCH=$(Build.SourceBranchName)
5455
echo Building branch $BRANCH from $(Build.SourceBranch)
5556
if [[ "$BRANCH" == "master" ]]; then
5657
echo "##vso[task.setvariable variable=Tag;isOutput=true]$(git describe --tags --abbrev=0)"
57-
echo "Set tag to $(git describe --tags --abbrev=0)"
58-
else
59-
echo "##vso[task.setvariable variable=Tag;isOutput=true]$(git describe --tags --always --dirty)"
60-
echo "Set tag to $(git describe --tags --always --dirty)"
6158
fi
6259
workingDirectory: "$(modulePath)"
6360
name: "EnvironmentalVariables"
64-
displayName: "Set build environmental variables"
61+
displayName: "Set environmental variables"
6562
condition: always()
6663
6764
- script: |
@@ -84,9 +81,9 @@ stages:
8481
export GOOS=linux
8582
make all-binaries VERSION=$(EnvironmentalVariables.Tag)
8683
sudo make azure-npm-image VERSION=$(EnvironmentalVariables.Tag)
87-
echo '$(DOCKER_PASSWORD)' | docker login -u '$(DOCKER_USERNAME)' --password-stdin
88-
docker tag containernetworking.azurecr.io/public/containernetworking/azure-npm:$(EnvironmentalVariables.Tag) containernetworking/azure-npm:$(EnvironmentalVariables.Tag)
89-
docker push containernetworking/azure-npm:$(EnvironmentalVariables.Tag)
84+
echo '$(DOCKER_PASSWORD)' | docker login containernetworking.azurecr.io -u '$(DOCKER_USERNAME)' --password-stdin
85+
docker tag $PUSH_CONTAINER_REGISTRY/azure-npm:$(EnvironmentalVariables.Tag) $PUSH_CONTAINER_REGISTRY/azure-npm:$(EnvironmentalVariables.Tag)-test
86+
docker push $PUSH_CONTAINER_REGISTRY/azure-npm:$(EnvironmentalVariables.Tag)-test
9087
cd output
9188
sudo find . -mindepth 2 -type f -regextype posix-extended ! -iregex '.*\.(zip|tgz)$' -delete
9289
sudo find . -mindepth 2 -type f -print -exec mv {} . \;
@@ -119,6 +116,21 @@ stages:
119116
displayName: "Generate Coverage Reports"
120117
condition: always()
121118
119+
- script: |
120+
function auto-retry()
121+
{
122+
export i="1"
123+
export attempts="300"
124+
false
125+
while [[ $? -ne 0 ]] && [[ $i -lt $attempts ]]; do
126+
printf "Attempt $i/$attempts - " && "$@" && break || sleep 3 && i=$[$i+1] && false
127+
done
128+
}
129+
auto-retry docker pull mcr.microsoft.com/containernetworking/azure-npm:$(EnvironmentalVariables.Tag)-test
130+
workingDirectory: "$(modulePath)"
131+
name: "mcrreplication"
132+
displayName: "Wait for MCR"
133+
122134
- task: PublishTestResults@2
123135
inputs:
124136
testRunner: JUnit
@@ -151,6 +163,7 @@ stages:
151163
azureSubscription: $(ARTIFACT_SUBSCRIPTION)
152164
scriptLocation: "inlineScript"
153165
inlineScript: |
166+
echo Creating storage container with name acn-$(EnvironmentalVariables.CommitHash) and account name $(STORAGE_ACCOUNT_NAME)
154167
az storage container create -n acn-$(EnvironmentalVariables.CommitHash) --account-name $(STORAGE_ACCOUNT_NAME) --public-access container
155168
az storage blob upload-batch -d acn-$(EnvironmentalVariables.CommitHash) -s ./output/ --account-name $(STORAGE_ACCOUNT_NAME)
156169
workingDirectory: "$(modulePath)"
@@ -201,17 +214,15 @@ stages:
201214
demands: agent.os -equals Linux
202215
container:
203216
image: containernetworking/pipeline-ci:1.0.6
204-
variables:
205-
Tag: $[ dependencies.unit_tests.outputs['EnvironmentalVariables.Tag'] ]
206217
condition: always()
207218
steps:
208-
- checkout: none
209219
- task: AzureCLI@1
210220
inputs:
211221
azureSubscription: $(ARTIFACT_SUBSCRIPTION)
212222
scriptLocation: "inlineScript"
213223
inlineScript: |
214-
export CommitHash=(git rev-parse HEAD)
224+
export CommitHash=$(git rev-parse HEAD)
225+
echo Deleting storage container with name acn-$CommitHash and account name $(STORAGE_ACCOUNT_NAME)
215226
az storage container delete -n acn-$CommitHash --account-name $(STORAGE_ACCOUNT_NAME)
216227
workingDirectory: "$(modulePath)"
217228
displayName: Cleanup remote Azure storage container

cns/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ RUN apt-get update && \
1010
apt-get install -y ca-certificates && \
1111
tar -xvzf azure-cns.tgz && \
1212
rm azure-cns.tgz
13+
RUN apt-get upgrade -y
1314

1415
EXPOSE 10090
1516

npm/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ RUN apt-get update
77
RUN apt-get install -y iptables
88
RUN apt-get install -y ipset
99
RUN apt-get install -y ca-certificates
10+
RUN apt-get upgrade -y
1011

1112
# Install plugin.
1213
COPY $NPM_BUILD_DIR/azure-npm /usr/bin

0 commit comments

Comments
 (0)