Skip to content

Commit

Permalink
Improve release process for ASO (#1372)
Browse files Browse the repository at this point in the history
- Also add some documentation on exactly what the process is.
  • Loading branch information
matthchr authored Feb 9, 2021
1 parent 4958aa1 commit c838a55
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 9 deletions.
5 changes: 3 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,10 @@ steps:
kustomize build config/default > $(Build.ArtifactStagingDirectory)/setup.yaml
set -x
echo $img > $(Build.ArtifactStagingDirectory)/azure-service-operator.txt
cp charts/azure-service-operator-0.1.0.tgz $(Build.ArtifactStagingDirectory)
mkdir $(Build.ArtifactStagingDirectory)/scripts
cp devops/release/scripts/*.sh $(Build.ArtifactStagingDirectory)/scripts
continueOnError: 'false'
displayName: Package artifacts (image, setup.yaml and helm charts) for release
displayName: Package artifacts (image, setup.yaml) for release
workingDirectory: '$(System.DefaultWorkingDirectory)'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
Expand Down
12 changes: 6 additions & 6 deletions devops/release/scripts/step1_releasepackage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ azureserviceoperator_image_base=$(echo $azureserviceoperator_image | cut -d':' -
azureserviceoperator_image_version=$(echo $azureserviceoperator_image | cut -d':' -f 2)
azureserviceoperator_image_latest=$(echo ${azureserviceoperator_image_base//candidate/public})':latest'

echo $azureserviceoperator_image
echo $azureserviceoperator_image_base
echo $azureserviceoperator_image_latest
echo $azureserviceoperator_image_public
echo "image: $azureserviceoperator_image"
echo "image_base: $azureserviceoperator_image_base"
echo "image_latest: $azureserviceoperator_image_latest"
echo "image_public: $azureserviceoperator_image_public"

echo "##vso[task.setvariable variable=azureserviceoperator_image_latest]$azureserviceoperator_image_latest"
echo "##vso[task.setvariable variable=azureserviceoperator_image]$azureserviceoperator_image"
Expand All @@ -27,11 +27,11 @@ echo "##vso[task.setvariable variable=azureserviceoperator_image_version]$azures

mkdir release/config -p
cp -r _Azure.azure-service-operator/drop/setup.yaml ./release/config
cp -r _Azure.azure-service-operator/drop/*.tgz ./release/config
IMG=${azureserviceoperator_image_public/"public/"/"mcr.microsoft.com/"}
echo "updating the manager image "
echo $IMG
sed -i'' -e 's@image: docker.io/controllertest:.*@image: '${IMG}'@' ./release/config/setup.yaml
sed -i'' -e 's@image: IMAGE_URL@image: '${IMG}'@' ./release/config/setup.yaml
sed -i'' -e 's@image: candidate/k8s@image: mcr.microsoft.com/k8s@' ./release/config/setup.yaml
echo ${azureserviceoperator_image_public/"public/"/"mcr.microsoft.com/"} >> ./release/notes.txt
cat ./release/config/setup.yaml
echo 'ls ./release'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ACR_NAME='azureserviceoperator'
ACR_NAME='asorelease'

echo "ACR_NAME", $ACR_NAME
echo "azureserviceoperator_image", $(azureserviceoperator_image)
Expand Down
21 changes: 21 additions & 0 deletions devops/release/scripts/step3_pushhelmchart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Note: This is not currently used as the Helm chart at the time of release doesn't have the correct container image version.

export HELM_EXPERIMENTAL_OCI=1
ACR_NAME='asorelease'

echo "ACR_NAME", $ACR_NAME
echo "azureserviceoperator_image", $(azureserviceoperator_image)
echo "azureserviceoperator_image_base", $(azureserviceoperator_image_base)
echo "azureserviceoperator_image_latest", $(azureserviceoperator_image_latest)
echo "azureserviceoperator_image_public", $(azureserviceoperator_image_public)
echo "azureserviceoperator_image_version", $(azureserviceoperator_image_version)

echo $(AZURE_CLIENT_SECRET) | helm registry login $ACR_NAME.azurecr.io --username $(AZURE_CLIENT_ID) --password-stdin

helm chart pull $ACR_NAME.azurecr.io/candidate/k8s/asohelmchart:$(azureserviceoperator_image_version)
helm chart export $ACR_NAME.azurecr.io/candidate/k8s/asohelmchart:$(azureserviceoperator_image_version) --destination .
cd azure-service-operator
helm chart save . $ACR_NAME.azurecr.io/public/k8s/asohelmchart:$(azureserviceoperator_image_version)
helm chart save . $ACR_NAME.azurecr.io/public/k8s/asohelmchart:latest
helm chart push $ACR_NAME.azurecr.io/public/k8s/asohelmchart:$(azureserviceoperator_image_version)
helm chart push $ACR_NAME.azurecr.io/public/k8s/asohelmchart:latest
27 changes: 27 additions & 0 deletions docs/howto/release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Releasing Azure Service Operator

The release process for Azure Service Operator has two steps:
1. Release an updated container image for the operator manager.
2. Reference the updated container image in a new Helm chart.

## Releasing an updated container image for the manager

1. Ensure you have a successful pipeline run off `master` that has all the changes you want to be in the release. If not, [schedule a run on Azure DevOps](http://dev.azure.com/azure/azure-service-operator). Note that you need to be signed in on DevOps to schedule a build.
- The output of this step is a _candidate_ container image.
2. Create a new [DevOps release](https://dev.azure.com/azure/azure-service-operator/_release?_a=releases&view=mine&definitionId=2). **Note**: The release must be created from a build of `master`. The release creation will fail if it is created targetting artifacts from any other branch.
- Click "create release" and choose the build from step 1 for "Artifacts".
- Click "Create".
3. Wait for the DevOps release created in step #2 to finish. The result of a successful run of the DevOps release is:
- The creation of a GitHub release you can access at https://github.com/Azure/azure-service-operator/releases. This release contains:
- A `setup.yaml` file complete with all of the Azure Service Operator CRDs and deployment configuration which can easily be applied directly to a cluster.
- `notes.txt` with a link to the Azure Service Operator manager docker image.


## Releasing an updated Helm chart

Because the Helm chart is hosted out of the GitHub repo itself, we cannot update it until an official container image for the ASO manager has been produced. Once the DevOps release has been run and a new image has been published, perform the following steps to generate a new version of the helm chart:

1. Create a new branch of ASO.
2. Update the `version` field of `charts/azure-service-operator/Chart.yaml`. Note that this field is the version of the _chart_, so it should follow semver for the chart. If there's a breaking change in the chart then the major version should be incremented, otherwise incrementing the minor version is fine.
2. Run `make helm-chart-manifests`. You should see a new chart `.tgz` get created and the new chart version you defined referenced in `charts/index.yaml`.
3. Submit a PR to ASO with the updated `Chart.yaml`, `index.yaml` and chart `.tgz` file.

0 comments on commit c838a55

Please sign in to comment.