Skip to content

Commit 8c28722

Browse files
authored
Edits to test pipeline and make unique tags (#28)
* Changed Pool and Tag * Edited Tag * Changed trigger branch from master to main * Moved variable section * Fixed Indentation * Changed helm install * Changed ORAS install * Delete helm chart from registry * Changed to pipeline workspace * Changed back to pipeline workspace * Changed Repo Path * Changed chart path * Corrected tag * Changed variable group * Added stage * changed stage name * Removed var group * Change acr cleanup step * changed tag var * Change tag format * changed workingDirectory for acr cleanup * Changed Tag format * Changed test and acr cleanup * Updated tests and edited acr cleanup * Changed add-extension script * edited add-extension * Changed ACR cleanup * Changed ACR cleanup * List helm charts in staging * Changed cleanup to az acr repo delete * Added newline * Added newline again * Changed to checkout.tag * Made global CHECKOUT_TAG * Corrected acr-cleanup * Deleted echo image.tag * Changed Unique tag generation
1 parent 2be909a commit 8c28722

10 files changed

+60
-26
lines changed

.pipelines/e2e-aks-arc.yaml

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
variables:
2-
repo.path: $(System.DefaultWorkingDirectory)/osm
3-
repo.chart.path: $(repo.path)/charts/$(chart.name)
4-
image.dir: $(Build.ArtifactStagingDirectory)
5-
image.artifact.name: drop
6-
KUBECONFIG: $(System.DefaultWorkingDirectory)/kubeconfig.json
7-
81
jobs:
92
- job: test_osm_chart_arc_cluster
3+
pool: Upstream Pool
104
workspace:
115
clean: all
126
steps:
@@ -18,4 +12,9 @@ jobs:
1812
- template: templates/add-arc-extension.yaml
1913
- script: |
2014
make test-e2e
15+
displayName: "Run e2e tests"
16+
env:
17+
CHECKOUT_TAG: $(CHECKOUT_TAG)
18+
- template: templates/acr-cleanup.yaml
2119
- template: templates/aks-cleanup.yaml
20+

.pipelines/e2e-job.yaml

+15-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
trigger:
22
branches:
33
include:
4-
- master
4+
- main
55

66
pr:
77
branches:
88
include:
9-
- master
9+
- main
1010
paths:
1111
exclude:
1212
- docs/*
1313

14-
jobs:
15-
pool: Upstream Pool
16-
- template: e2e-aks-arc.yaml
14+
variables:
15+
chart.name: osm-arc
16+
repo.path: $(System.DefaultWorkingDirectory)
17+
repo.chart.path: $(repo.path)/charts/$(chart.name)
18+
image.dir: $(Build.ArtifactStagingDirectory)
19+
image.artifact.name: drop
20+
KUBECONFIG: $(System.DefaultWorkingDirectory)/kubeconfig.json
21+
image.tag: 0.1.0
22+
23+
stages:
24+
- stage: run_e2e
25+
jobs:
26+
- template: e2e-aks-arc.yaml

.pipelines/templates/acr-cleanup.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
steps:
2+
- bash: |
3+
az login --identity
4+
echo ${CHECKOUT_TAG}
5+
az acr repository delete -n $(registry.name) --image oss/openservicemesh/osm-chart:${CHECKOUT_TAG} --yes
6+
displayName: Delete helm chart from staging registry
7+
workingDirectory: $(repo.path)
8+
condition: always()

.pipelines/templates/add-arc-extension.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ steps:
66
SUBSCRIPTION: $(SUBSCRIPTION_ID)
77
RESOURCEGROUP: $(AZURE_CLUSTER_NAME)
88
CLUSTERNAME: $(AZURE_CLUSTER_NAME)
9-
CHECKOUT_TAG: $(checkout.tag)
9+
CHECKOUT_TAG: $(CHECKOUT_TAG)
1010
REGION: $(AZURE_LOCATION)
1111
RELEASE_NAMESPACE: $(release.namespace)
1212
workingDirectory: $(repo.path)
+6-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
parameters:
2+
version: v3.1.1
3+
14
steps:
25
- bash: |
3-
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
6+
curl -LO https://get.helm.sh/helm-${{ parameters.version }}-linux-amd64.zip
7+
unzip -o helm-${{ parameters.version }}-linux-amd64.zip
48
displayName: Install Helm
59
workingDirectory: $(Pipeline.Workspace)
610
- bash: |
7-
echo "##vso[task.setvariable variable=PATH]${PATH}:$(Pipeline.Workspace)/linux-amd64"
11+
echo "##vso[task.setvariable variable=PATH]${PATH}:$(Pipeline.Workspace)/linux-amd64"
812
displayName: Add Helm to PATH
913
- bash: helm version
1014
displayName: Print helm version

.pipelines/templates/install-oras.yaml

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@ steps:
88
tar xvzf oras_${{ parameters.version }}_linux_amd64.tar.gz -C oras/
99
displayName: Install ORAS
1010
workingDirectory: $(Pipeline.Workspace)
11-
- bash: ./oras version
11+
- bash: |
12+
tree $(Pipeline.Workspace)
13+
echo "##vso[task.setvariable variable=PATH]${PATH}:$(Pipeline.Workspace)/oras"
14+
displayName: Add oras to PATH
15+
- bash: oras version
1216
displayName: Print oras version
+11-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
steps:
2+
- script: |
3+
echo "##vso[task.setvariable variable=UNIQUE_TAG]$(git rev-parse --short HEAD)"
4+
echo ${UNIQUE_TAG}
5+
displayName: Create Unique Tag
6+
- script: |
7+
echo "##vso[task.setvariable variable=CHECKOUT_TAG]$(image.tag)-${UNIQUE_TAG}"
8+
echo ${CHECKOUT_TAG}
9+
displayName: Create Checkout Tag
210
- bash: |
3-
helm dependency update osm-arc
4-
helm package --version $(image.tag) --destination $(image.dir) $(repo.chart.path) --debug
11+
cd linux-amd64
12+
helm dependency update $(repo.chart.path)
13+
helm package --version ${CHECKOUT_TAG} --destination $(image.dir) $(repo.chart.path) --debug
514
displayName: Package the helm chart
615
workingDirectory: $(repo.path)

.pipelines/templates/publish-helm-chart.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ steps:
44
az acr login --name $(registry.name)
55
displayName: Login to acr
66
- bash: |
7-
cp $(image.dir)/$(chart.name)-$(image.tag).tgz .
7+
cp $(image.dir)/$(chart.name)-${CHECKOUT_TAG}.tgz .
88
echo 'pushing chart'
9-
oras push $(staging.registry):$(image.tag) ./$(chart.name)-$(image.tag).tgz:application/tar+gzip --debug
9+
oras push $(staging.registry):${CHECKOUT_TAG} ./$(chart.name)-${CHECKOUT_TAG}.tgz:application/tar+gzip --debug
1010
displayName: Push helm chart to staging ACR
1111
workingDirectory: $(repo.path)
1212
env:
1313
HELM_EXPERIMENTAL_OCI: 1
1414
- task: PublishBuildArtifacts@1
15-
displayName: Publish artifacts
16-
inputs:
17-
artifactName: $(image.artifact.name)
18-
pathToPublish: $(image.dir)
15+
displayName: Publish artifacts
16+
inputs:
17+
artifactName: $(image.artifact.name)
18+
pathToPublish: $(image.dir)

scripts/add-extension.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ az resource tag --tags logAnalyticsWorkspaceResourceId=/$RESOURCEID --ids /$RESO
3131
az rest --method GET --uri "https://management.azure.com/$RESOURCEID/providers/Microsoft.KubernetesConfiguration/extensions?api-Version=2020-07-01-preview"
3232

3333
# enable the osm extension
34-
az rest --method PUT --uri "https://management.azure.com/$RESOURCEID/providers/Microsoft.KubernetesConfiguration/extensions/osm?api-Version=2020-07-01-preview" --body @osm_extension.json --debug
34+
az rest --method PUT --uri "https://management.azure.com/$RESOURCEID/providers/Microsoft.KubernetesConfiguration/extensions/osm?api-Version=2020-07-01-preview" --body @osm_extension.json --debug

test/bats/test.bats

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ SLEEP_TIME_DEPLOYMENTS=10
1818
}
1919

2020
@test "chart version on cluster matches checkout tag" {
21-
[[ "$(helm ls -o json --namespace arc-osm-system | jq -r '.[].chart')" == "osm-arc-$(image.tag)" ]]
21+
[[ "$(helm ls -o json --namespace arc-osm-system | jq -r '.[].chart')" == "osm-arc-$CHECKOUT_TAG" ]]
2222
}
2323

2424
@test "osm pod is ready" {

0 commit comments

Comments
 (0)