forked from Dynatrace/dynatrace-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
183 lines (156 loc) · 5.24 KB
/
.travis.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
language: go
go: 1.16.x
os: linux
dist: xenial
gobuild_args: -tags containers_image_storage_stub
notifications:
email:
on_success: never
cache:
directories:
- /usr/local/kubebuilder/bin
- $HOME/.cache/go-build
- $HOME/gopath/pkg/mod
stages:
- preparation
- build
env:
global:
- COMMIT=$TRAVIS_COMMIT
- TAG=$TRAVIS_TAG
- VERSION_TAG=/^v.*/
- DOCKER_CLI_EXPERIMENTAL=enabled
jobs:
include:
- stage: preparation
name: Tests
script: ./build/test.sh
cache:
directories:
- /usr/local/kubebuilder/bin
- stage: preparation
name: Linting
language: go
script:
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.31.0
- golangci-lint run --build-tags integration,containers_image_storage_stub --timeout 300s
- stage: preparation
name: Set configs
install: skip
language: shell
git:
clone: false
script:
- mkdir -p ~/.docker && chmod 0700 ~/.docker
- touch ~/.docker/config.json && chmod 0600 ~/.docker/config.json
- base64 -d >~/.docker/config.json <<<"$OAO_DOCKER_AUTH"
workspaces:
create:
name: dockerconfig
paths:
- $HOME/.docker
######################### AMD #########################
- &deploy_amd
script: ./build/deploy.sh
stage: deploy
name: Deploy snapshot master AMD to Quay
arch: amd64
if: (branch = master) AND (tag IS blank)
env: IMAGES=$OAO_IMAGE_QUAY TAG="snapshot"
cache:
directories:
- $GOPATH/pkg/mod
workspaces:
use:
- dockerconfig
- <<: *deploy_amd
name: Deploy snapshot non-master branch AMD to Quay
if: (branch != master) AND (tag IS blank)
env: IMAGES=$OAO_IMAGE_QUAY TAG="snapshot-$(echo $TRAVIS_BRANCH | sed 's#[^a-zA-Z0-9_-]#-#g')" LABEL="quay.expires-after=10d"
- <<: *deploy_amd
name: Deploy release AMD to DockerHub, Quay, RHCC
if: tag =~ /^v.*/
env: IMAGES="$OAO_IMAGE_DOCKER_HUB $OAO_IMAGE_QUAY $OAO_IMAGE_RHCC_SCAN"
- <<: *deploy_amd
name: Deploy release AMD to GCP dev
if: tag =~ /^v.*/
env: GCR=true GCP_PROJECT=dynatrace-marketplace-dev GCLOUD_SERVICE_KEY=$GCLOUD_SERVICE_KEY_DEV GCP_SERVICE_ACCOUNT=$GCP_SERVICE_ACCOUNT_DEV IMAGES=$OAO_IMAGE_GCR_DEV
- <<: *deploy_amd
name: Deploy release AMD to GCP prod
if: tag =~ /^v.*/
env: GCR=true GCP_PROJECT=dynatrace-marketplace-prod GCLOUD_SERVICE_KEY=$GCLOUD_SERVICE_KEY_PROD GCP_SERVICE_ACCOUNT=$GCP_SERVICE_ACCOUNT_PROD IMAGES=$OAO_IMAGE_GCR_PROD
######################### ARM #########################
- &deploy_arm
install: skip
script: ./build/deploy.sh
stage: deploy
name: Deploy snapshot master ARM to Quay
arch: arm64
if: (branch = master) AND (tag IS blank)
env: IMAGES=$OAO_IMAGE_QUAY TAG="snapshot"
cache:
directories:
- $GOPATH/pkg/mod
workspaces:
use:
- dockerconfig
- <<: *deploy_arm
name: Deploy snapshot non-master branch ARM to Quay
if: (branch != master) AND (tag IS blank)
env: IMAGES=$OAO_IMAGE_QUAY TAG="snapshot-$(echo $TRAVIS_BRANCH | sed 's#[^a-zA-Z0-9_-]#-#g')" LABEL="quay.expires-after=10d"
- <<: *deploy_arm
name: Deploy release ARM to DockerHub, Quay
if: tag =~ /^v.*/
env: IMAGES="$OAO_IMAGE_DOCKER_HUB $OAO_IMAGE_QUAY"
######################### Create Docker manifest #########################
- &create_manifest
stage: manifest
install: skip
language: generic
name: Create manifest for snapshot master for Quay
if: (branch = master) AND (tag IS blank)
env: IMAGE=$OAO_IMAGE_QUAY TAG="snapshot"
git:
clone: false
script:
- sudo chmod o+x /etc/docker
- docker manifest create $IMAGE:$TAG $IMAGE:$TAG-arm64 $IMAGE:$TAG-amd64
- docker manifest push $IMAGE:$TAG
workspaces:
use: dockerconfig
- <<: *create_manifest
name: Create manifest for non-master snapshot for Quay
if: (branch != master) AND (tag IS blank)
env: IMAGE=$OAO_IMAGE_QUAY TAG="snapshot-$(echo $TRAVIS_BRANCH | sed 's#[^a-zA-Z0-9_-]#-#g')"
- <<: *create_manifest
stage: manifest
name: Create manifest for release for DockerHub
if: tag =~ /^v.*/
env: IMAGE=$OAO_IMAGE_DOCKER_HUB
- <<: *create_manifest
stage: manifest
name: Create manifest for release for Quay
if: tag =~ /^v.*/
env: IMAGE=$OAO_IMAGE_QUAY
######################### Prepare CSV #########################
- stage: release
name: Prepare CSV file
if: tag =~ /^v.*/
install: skip
script: ./build/prepare_csv.sh
######################### Publish release artefacts #########################
- stage: release
name: publish_release
if: tag =~ /^v.*/
install: skip
language: minimal
before_deploy: ./build/release.sh
deploy:
provider: releases
file_glob: true
api_key:
secure: $GITHUB_RELEASE_API_KEY
file: ./artefacts/*
skip_cleanup: true
on:
tags: true