Skip to content

Commit

Permalink
Merge branch 'master' into psqluser-crd-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamMortlMicrosoft authored Jun 4, 2020
2 parents 05c4fd6 + 0f743cb commit 04611a4
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 17 deletions.
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ test-process-coverage:
test-cleanup-azure-resources:
# Delete the resource groups that match the pattern
for rgname in `az group list --query "[*].[name]" -o table | grep '^${TEST_RESOURCE_PREFIX}' `; do \
echo "$$rgname will be deleted"; \
az group delete --name $$rgname --no-wait --yes; \
done
echo "$$rgname will be deleted"; \
az group delete --name $$rgname --no-wait --yes; \
done

# Build the docker image
docker-build:
Expand Down Expand Up @@ -144,6 +144,10 @@ delete:
validate-copyright-headers:
@./scripts/validate-copyright-headers.sh

# Validate cainjection files:
validate-cainjection-files:
@./scripts/validate-cainjection-files.sh

# Generate manifests for helm and package them up
helm-chart-manifests: manifests
mkdir charts/azure-service-operator/templates/generated
Expand Down
15 changes: 7 additions & 8 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ variables:
steps:
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
lfs: "true"

- script: |
make validate-copyright-headers
make validate-cainjection-files
displayName: 'Validate Source'
continueOnError: 'false'
- task: GoTool@0
displayName: Get Go 1.13.7
Expand Down Expand Up @@ -89,14 +95,7 @@ steps:
go mod download
make install-test-dependencies
workingDirectory: '$(System.DefaultWorkingDirectory)'

- task: Bash@3
inputs:
targetType: 'inline'
script: 'make validate-copyright-headers'
workingDirectory: '$(System.DefaultWorkingDirectory)'
displayName: 'Validate Copyright Headers'


- script: |
set -e
export PATH=$PATH:$(go env GOPATH)/bin
Expand Down
12 changes: 6 additions & 6 deletions devops/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ steps:
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
lfs: "true"

- script: |
make validate-copyright-headers
make validate-cainjection-files
displayName: 'Validate Source'
continueOnError: 'false'

- script: |
set -x
ls -l /usr/local/go*
Expand Down Expand Up @@ -99,12 +105,6 @@ steps:
# REQUEUE_AFTER: $(REQUEUE_AFTER)
# workingDirectory: '$(MODULE_PATH)'

- script: |
make validate-copyright-headers
continueOnError: 'false'
displayName: 'Validate Copyright Headers'
workingDirectory: '$(MODULE_PATH)'

- script: |
set -e
GO111MODULE="on" go get sigs.k8s.io/kind@v0.7.0
Expand Down
18 changes: 18 additions & 0 deletions scripts/validate-cainjection-files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

invalid_files=$(grep -L "cert-manager.io" ./config/crd/patches/cainjection*.yaml)

# using a subshell to not modify the IFS variable that determines how the expression "${arr[*]}" is output
# this workaround allows us to reject an array containing empty elements
(IFS='' ; [[ -n "${invalid_files[*]}" ]] ); is_empty=$?

# fail validation if the array is not empty
if [[ $is_empty -eq 0 ]]; then
echo "Validation check failed for the following files:"
for file in $invalid_files; do
echo " $file"
done
echo "Run the following command to fix the files:"
echo " sed -i '' 's/certmanager.k8s.io/cert-manager.io/' ./config/crd/patches/cainjection*.yaml"
exit 1
fi

0 comments on commit 04611a4

Please sign in to comment.