forked from exceptionless/Exceptionless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
87 lines (77 loc) · 3.3 KB
/
appveyor.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
version: '{build}'
image: ubuntu
clone_depth: 2
services:
- docker
environment:
API_DOCKER_IMAGE: api-ci
JOB_DOCKER_IMAGE: job-ci
pull_requests:
do_not_increment_build_number: true
init:
- git config --global core.autocrlf input
before_build:
- |
VERSION_PREFIX=$(sed -n 's/.*<VersionPrefix>\([^<]*\)<\/VersionPrefix>.*/\1/p' <<< cat ./build/common.props)
if [ $APPVEYOR_REPO_TAG != "true" ]; then
VERSION_SUFFIX="$APPVEYOR_BUILD_NUMBER-pre"
VERSION="$VERSION_PREFIX.$VERSION_SUFFIX"
echo "Version: $VERSION"
else
API_DOCKER_IMAGE=api
JOB_DOCKER_IMAGE=job
VERSION_SUFFIX=$APPVEYOR_BUILD_NUMBER
VERSION="$VERSION_PREFIX.$VERSION_SUFFIX"
echo "Version: $VERSION Tag: $APPVEYOR_REPO_TAG_NAME"
fi
if [ -z $APPVEYOR_PULL_REQUEST_NUMBER ]; then
appveyor UpdateBuild -Version $VERSION
fi
install:
- |
curl https://get.helm.sh/helm-v3.0.2-linux-amd64.tar.gz -o helm.tar.gz
tar -zxvf helm.tar.gz
sudo mv linux-amd64/helm /usr/local/bin/helm
build_script:
- docker build --target testrunner -t exceptionless:test --build-arg VERSION_SUFFIX=$VERSION_SUFFIX .
- docker run -d -m 2g -p 9200:9200 -p 9300:9300 -e discovery.type=single-node -e xpack.security.enabled=false -e ES_JAVA_OPTS='-Xms512m -Xmx512m' exceptionless/elasticsearch:7.5.2
- docker run -e APPVEYOR_API_URL --net=host -v $(pwd)/artifacts:/app/artifacts exceptionless:test
- docker build --target api -t $API_DOCKER_IMAGE --build-arg VERSION_SUFFIX=$VERSION_SUFFIX .
- docker build --target job -t $JOB_DOCKER_IMAGE --build-arg VERSION_SUFFIX=$VERSION_SUFFIX .
deploy_script:
- echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
- |
# tag and push docker image
for image in {$API_DOCKER_IMAGE,$JOB_DOCKER_IMAGE}; do
for tag in {$VERSION,latest}; do
docker tag $image exceptionless/$image:$tag
docker push exceptionless/$image:$tag
done
done
- |
echo "Branch: $APPVEYOR_REPO_BRANCH"
echo "PR: $APPVEYOR_PULL_REQUEST_NUMBER"
if [[ "$APPVEYOR_REPO_BRANCH" == "master" && "$APPVEYOR_PULL_REQUEST_NUMBER" == "" ]]; then
# deploy to prod k8s cluster
az login --service-principal --username $AZ_USERNAME --password $AZ_PASSWORD --tenant $AZ_TENANT --output none
az aks get-credentials --resource-group exceptionless-v6 --name ex-k8s-v6
helm upgrade --set "api.image.tag=$VERSION" --set "jobs.image.tag=$VERSION" --reuse-values ex-prod --namespace ex-prod ./k8s/exceptionless
else
echo "Skipping prod deployment"
fi
if [[ "$APPVEYOR_REPO_BRANCH" == "master" && "$APPVEYOR_PULL_REQUEST_NUMBER" == "" ]]; then
# deploy to dev k8s cluster
az login --service-principal --username $AZ_USERNAME --password $AZ_PASSWORD --tenant $AZ_TENANT --output none
az aks get-credentials --resource-group exceptionless-v6 --name ex-k8s-v6
helm upgrade --set "api.image.tag=$VERSION" --set "jobs.image.tag=$VERSION" --reuse-values ex-dev --namespace ex-dev ./k8s/exceptionless
else
echo "Skipping dev deployment"
fi
artifacts:
- path: artifacts/*.trx
name: Test Results
notifications:
- provider: Slack
auth_token:
secure: GniMpFE62HprSyQNQoej/VSBnxn2GNnTrca3BnF8+ikMdqduO4Ts4t297teZF6wDAmGwnOtXusctUla8+WxLFkIztvVCS2Z1RG/DvEDYoc0=
channel: '#notifications'