This repository has been archived by the owner on Jan 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create azure-pipelines-ci-artifacts.yaml
- Loading branch information
1 parent
82b3603
commit bdc6fbf
Showing
1 changed file
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
pool: | ||
vmImage: 'Ubuntu 16.04' | ||
|
||
variables: | ||
GOBIN: '$(GOPATH)/bin' # Go binaries path | ||
GOROOT: '/usr/local/go1.12.1' # Go installation path | ||
GOPATH: '$(system.defaultWorkingDirectory)/gopath' # Go workspace path | ||
modulePath: '$(GOPATH)/src/$(build.repository.name)' # Path to the module's code | ||
IMAGE_NAME: 'public/k8s/azure-databricks/operator:$(Build.SourceVersion)' | ||
#ACR_NAME - set this value in AzureDevops variables | ||
#AZURE_SUBSCRIPTION - set this value in AzureDevops variables | ||
steps: | ||
- script: | | ||
mkdir -p '$(GOBIN)' | ||
mkdir -p '$(GOPATH)/pkg' | ||
mkdir -p '$(modulePath)' | ||
shopt -s extglob | ||
mv !(gopath) '$(modulePath)' | ||
echo '##vso[task.prependpath]$(GOBIN)' | ||
echo '##vso[task.prependpath]$(GOROOT)/bin' | ||
echo 'GOPATH' | ||
ls $(GOPATH) | ||
echo 'modulePath' | ||
ls $(modulePath) | ||
echo 'GOBIN' | ||
echo $(GOBIN) | ||
echo 'GOROOT' | ||
echo $(GOROOT) | ||
echo 'GOPATH' | ||
echo $(GOPATH) | ||
echo 'modulePath' | ||
echo $(modulePath) | ||
displayName: 'Set up the Go workspace' | ||
|
||
|
||
- script: | | ||
sudo rm -rf $HOME/.minikube/ | ||
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.13.4/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/ | ||
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v1.0.0/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/ | ||
sudo minikube start --vm-driver=none --bootstrapper=kubeadm --kubernetes-version=v1.13.4 --extra-config kubeadm.ignore-preflight-errors=SystemVerification | ||
sudo chmod --recursive 777 $HOME/.minikube | ||
sudo chmod --recursive 777 $HOME/.kube | ||
minikube update-context | ||
# Wait for Kubernetes to be up and ready. | ||
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1; done | ||
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl -n kube-system get pods -lcomponent=kube-addon-manager -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1;echo "waiting for kube-addon-manager to be available"; kubectl get pods --all-namespaces; done | ||
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl -n kube-system get pods -lk8s-app=kube-dns -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1;echo "waiting for kube-dns to be available"; kubectl get pods --all-namespaces; done | ||
kubectl cluster-info | ||
workingDirectory: '$(modulePath)' | ||
continueOnError: 'true' | ||
displayName: 'Set up the Kubernetes installation' | ||
|
||
|
||
|
||
- script: | | ||
go version | ||
go env | ||
# go get -v -t -d ./... | ||
if [ -f Gopkg.toml ]; then | ||
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh | ||
dep ensure | ||
fi | ||
go get github.com/jstemmer/go-junit-report | ||
go get github.com/axw/gocov/gocov | ||
go get github.com/AlekSi/gocov-xml | ||
go get -u gopkg.in/matm/v1/gocov-html | ||
workingDirectory: '$(modulePath)' | ||
displayName: 'Get dependencies' | ||
|
||
- script: | | ||
make build | ||
workingDirectory: '$(modulePath)' | ||
continueOnError: 'false' | ||
displayName: 'Build app' | ||
|
||
- script: | | ||
make install | ||
make test | ||
continueOnError: 'true' | ||
workingDirectory: '$(modulePath)' | ||
displayName: 'Run unit tests' | ||
|
||
- script: docker build -t $(IMAGE_NAME) . # add options to this command to meet your needs | ||
workingDirectory: '$(modulePath)' | ||
displayName: 'Docker build' | ||
|