Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipeline updates #1072

Merged
merged 27 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5331ca1
updates for APIM test to take preconfigured service as env
jananivMS May 15, 2020
5af15c9
change image name to reflect MCR repo name
jananivMS May 15, 2020
13108f9
install CRDS before helm deploy
jananivMS May 16, 2020
d434ee2
Merge branch 'master' of https://github.com/Azure/azure-service-opera…
jananivMS May 16, 2020
5b05de7
helm chart updates
jananivMS May 16, 2020
4864b02
update trigger
jananivMS May 16, 2020
6e064f2
fix CRD kubebuilder resource directive with correct path
jananivMS May 18, 2020
f734e2d
remove helm generated files
jananivMS May 18, 2020
4c80339
fix crd issues
jananivMS May 18, 2020
110044e
fix VNet reconciler that causes mysql test failure
jananivMS May 18, 2020
4f8a792
adding to all version types
jananivMS May 18, 2020
056085a
upddated helm charts
jananivMS May 18, 2020
e1bc7fb
crd updates
jananivMS May 18, 2020
0492a84
merge master
jananivMS May 18, 2020
3a95d1e
helm chart updates
jananivMS May 18, 2020
18417c9
wait to check for pods to be ready
jananivMS May 19, 2020
055a5ac
test master condition stages
jananivMS May 19, 2020
f1eb058
Comment conditions to test
jananivMS May 19, 2020
300954a
comment condition
jananivMS May 19, 2020
c11c365
Merge branch 'pipeline-updates' of https://github.com/Azure/azure-ser…
jananivMS May 19, 2020
330c7af
debugging helm chart push
jananivMS May 19, 2020
385a6cc
fixed container registry name
jananivMS May 19, 2020
f2056a7
missed replacing vars
jananivMS May 19, 2020
65262ed
helm regsutry login
jananivMS May 19, 2020
dd99436
add back master branch conditions
jananivMS May 19, 2020
6b51ed2
updated helm charts
jananivMS May 19, 2020
141a289
Merge branch 'master' into pipeline-updates
WilliamMortlMicrosoft May 19, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 34 additions & 5 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
trigger:
- azdo-pipelines
branches:
include:
- master
- pipeline-updates

resources:
- repo: self
Expand All @@ -18,7 +21,8 @@ variables:
#GOPATH: '$(System.DefaultWorkingDirectory)/gopath' # Go workspace path
#GOBIN: '$(GOPATH)/bin' # Go binaries path
MODULE_PATH: '$(System.DefaultWorkingDirectory)/src/$(Build.Repository.Name)' # Path to the module's code
IMAGE_NAME: 'candidate/k8s/azure-service-operator'
IMAGE_NAME: 'candidate/k8s/azureserviceoperator'
ASO_HELM_CHART_NAME: 'candidate/k8s/asohelmchart'
KUBEBUILDER_ASSETS: $(go env GOPATH)/bin
# CONTAINER_REGISTRY: - set this value in Azure Devops variables - Name of Release ACR Service Connection
# AZURE_SUBSCRIPTION_ID - set this value in Azure Devops variables
Expand Down Expand Up @@ -91,8 +95,11 @@ steps:
export KUBECONFIG=$(kind get kubeconfig-path --name="kind")
kubectl cluster-info
make install
export TEST_APIM_RG=$(TEST_APIM_RG)
export TEST_APIM_NAME=$(TEST_APIM_NAME)
make test-integration-controllers
displayName: Run tests on a Kind Cluster
continueOnError: 'false'
env:
GO111MODULE: on
AZURE_SUBSCRIPTION_ID: $(AZURE_SUBSCRIPTION_ID)
Expand Down Expand Up @@ -131,8 +138,9 @@ steps:

- task: AzureCLI@2
displayName: Test - Cleanup Azure Resources
condition: always()
inputs:
azureSubscription: 'tpark-jananiv-azureserviceoperators(4ef44fef-c51d-4d7c-a6ff-8635c02848b1)'
azureSubscription: 'ASO Subscription'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: 'make test-cleanup-azure-resources'
Expand Down Expand Up @@ -182,7 +190,7 @@ steps:
# Replace image repository in values.yaml to the official image in ACR
img="$MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION"
echo $img
sed -i -e 's@azure-service-operator:latest@azure-service-operator:'${img}'@' charts/azure-service-operator/values.yaml
sed -i -e 's@azure-service-operator:latest@azureserviceoperator:'${img}'@' charts/azure-service-operator/values.yaml
# create directory for generated files
mkdir charts/azure-service-operator/templates/generated
# generate files using kustomize
Expand All @@ -203,7 +211,7 @@ steps:
# update Chart.yaml for Helm Repository
helm repo index ./charts
# remove directory containing generated manifests for Helm Chart
rm -rf charts/azure-service-operator/templates/generated/
#rm -rf charts/azure-service-operator/templates/generated/
displayName: Deploy to AKS - Helm generate and package charts

# - task: KubernetesManifest@0
Expand Down Expand Up @@ -237,6 +245,7 @@ steps:
kubectl delete namespace $(OPERATOR_NAMESPACE)
imagename="$(PIPELINE_CONTAINER_REGISTRY_NAME)/$(IMAGE_NAME):$(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_VERSION)"
echo $imagename
make install
helm upgrade --install aso charts/azure-service-operator-0.1.0.tgz \
--set azureSubscriptionID=$(AZURE_SUBSCRIPTION_ID) \
--set azureTenantID=$(AZURE_TENANT_ID) \
Expand All @@ -251,6 +260,9 @@ steps:
--set namespace=$(OPERATOR_NAMESPACE)
kubectl get namespace
kubectl get pods -n $(OPERATOR_NAMESPACE)
kubectl describe pods -n $(OPERATOR_NAMESPACE)
kubectl rollout status deployment/azureoperator-controller-manager -n $(OPERATOR_NAMESPACE) --timeout 120s
kubectl logs -n $(OPERATOR_NAMESPACE) deployment/azureoperator-controller-manager -c manager

# - task: HelmDeploy@0
# inputs:
Expand Down Expand Up @@ -284,6 +296,23 @@ steps:
tags: |
latest
$(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_VERSION)

- script: |
export HELM_EXPERIMENTAL_OCI=1
cd charts/azure-service-operator
versiontag="$(CONTAINER_REGISTRY_NAME)/$(ASO_HELM_CHART_NAME):$(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_VERSION)"
latesttag="$(CONTAINER_REGISTRY_NAME)/$(ASO_HELM_CHART_NAME):latest"
echo $versiontag
echo $latesttag
echo $(AZURE_CLIENT_SECRET)|helm registry login $(CONTAINER_REGISTRY_NAME) --username $(AZURE_CLIENT_ID) --password-stdin
helm chart save . $versiontag
helm chart save . $latesttag
helm chart push $versiontag
helm chart push $latesttag
continueOnError: 'true'
displayName: Push Helm chart to MCR repo
workingDirectory: '$(System.DefaultWorkingDirectory)'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))

- script: |
echo "updating kustomize image patch file for manager resource"
Expand Down
Binary file modified charts/azure-service-operator-0.1.0.tgz
Binary file not shown.
6 changes: 3 additions & 3 deletions charts/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ entries:
azure-service-operator:
- apiVersion: v2
appVersion: 0.1.0
created: "2020-04-23T11:50:42.794582-07:00"
created: "2020-05-18T22:30:28.349199-06:00"
dependencies:
- condition: azureUseMI
name: aad-pod-identity
repository: https://raw.githubusercontent.com/Azure/aad-pod-identity/master/charts
version: 1.5.5
description: Deploy components and dependencies of azure-service-operator
digest: 6aaf972ecdc1aad3c0e9b4c414d8b39cc33c40f17ef8b8985b3c8acfac80bc72
digest: e5aaaa1c15802982f7a943e737b2ae39a2404d395fec299376fb19e15fc9e6f2
home: https://github.com/Azure/azure-service-operator
name: azure-service-operator
sources:
- https://github.com/Azure/azure-service-operator
urls:
- azure-service-operator-0.1.0.tgz
version: 0.1.0
generated: "2020-04-23T11:50:42.791883-07:00"
generated: "2020-05-18T22:30:28.343398-06:00"
17 changes: 15 additions & 2 deletions controllers/apimgmt_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package controllers

import (
"context"
"os"
"testing"

azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1"
Expand All @@ -22,6 +23,18 @@ func TestAPIMgmtController(t *testing.T) {
// rgName := tc.resourceGroupName
rgLocation := "southcentralus"
apiMgmtName := "t-apimgmt-test" + helpers.RandomString(10)
rgName := "AzureOperatorsTest"
apimServiceName := "AzureOperatorsTestAPIM"

// Read the pre-created APIM service name and RG name from Environment variable if it exists
rgFromEnv := os.Getenv("TEST_APIM_RG")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we just fail id the env vars don't exist? are these hard coded strings correct if the nev vars aren't set?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do fall back to a default value for both so we should good for now. But I can open an issue to edit this for later once the old pipeline is retired.

if len(rgFromEnv) != 0 {
rgName = rgFromEnv
}
nameFromEnv := os.Getenv("TEST_APIM_NAME")
if len(nameFromEnv) != 0 {
apimServiceName = nameFromEnv
}

// Create an instance of Azure APIMgmnt
apiMgmtInstance := &azurev1alpha1.APIMgmtAPI{
Expand All @@ -31,8 +44,8 @@ func TestAPIMgmtController(t *testing.T) {
},
Spec: azurev1alpha1.APIMgmtSpec{
Location: rgLocation,
ResourceGroup: "AzureOperatorsTest",
APIService: "AzureOperatorsTestAPIM",
ResourceGroup: rgName,
APIService: apimServiceName,
APIId: "apiId0",
Properties: azurev1alpha1.APIProperties{
IsCurrent: true,
Expand Down
17 changes: 10 additions & 7 deletions pkg/resourcemanager/vnet/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/http"
"strings"

"github.com/Azure/azure-sdk-for-go/profiles/latest/network/mgmt/network"
azurev1alpha1 "github.com/Azure/azure-service-operator/api/v1alpha1"
"github.com/Azure/azure-service-operator/pkg/errhelp"
"github.com/Azure/azure-service-operator/pkg/helpers"
Expand All @@ -35,13 +36,15 @@ func (g *AzureVNetManager) Ensure(ctx context.Context, obj runtime.Object, opts
// consider the reconcilliation successful
vNet, err := g.GetVNet(ctx, resourceGroup, resourceName)
if err == nil {
// succeeded! end reconcilliation successfully
instance.Status.Provisioning = false
instance.Status.Provisioned = true
instance.Status.FailedProvisioning = false
instance.Status.Message = resourcemanager.SuccessMsg
instance.Status.ResourceId = *vNet.ID
return true, nil
if vNet.ProvisioningState == network.Succeeded {
// succeeded! end reconcilliation successfully
instance.Status.Provisioning = false
instance.Status.Provisioned = true
instance.Status.FailedProvisioning = false
instance.Status.Message = resourcemanager.SuccessMsg
instance.Status.ResourceId = *vNet.ID
return true, nil
}
}

instance.Status.Provisioning = true
Expand Down