-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis.yml
63 lines (60 loc) · 2.17 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
language: bash
stages:
- name: "Build test image non-pr"
if: tag is blank AND branch != main AND type != pull_request
- name: "Build test image pr"
if: tag is blank AND branch != main AND type = pull_request
- name: "Build production image"
if: branch = main AND type != pull_request AND tag is blank
- name: "Build platform image"
if: tag is present
before_install:
# Install the buildx plugin
- mkdir -vp ~/.docker/cli-plugins/
- curl --silent -L "https://github.com/docker/buildx/releases/download/v0.9.1/buildx-v0.9.1.linux-amd64" > ~/.docker/cli-plugins/docker-buildx
- chmod a+x ~/.docker/cli-plugins/docker-buildx
# Enable experimental features
- export DOCKER_CLI_EXPERIMENTAL=enabled
- export DOCKER_BUILD_KIT=1
# Change buildx output style
- export BUILDKIT_PROGRESS=plain
- set -e
before_script:
- pip install black
- black --check .
after_success:
- curl -H "Authorization:Bearer $ARTIFACTORY_TOKEN" $TWISTLOCK_DL_ENDPOINT --output tt_latest.zip
- unzip tt_latest.zip
- cd tt_*/linux_x86_64
- chmod +x tt
- ./tt image pull-and-scan --imagetype prod --user $TT_USER:$TT_API_KEY --url $TWISTLOCK_ENDPOINT --control-group $TT_CONTROL_GROUP --output-format json $FULL_IMAGE_ID || travis_terminate 1
jobs:
include:
- stage: "Build test image non-pr"
os: linux
services:
- docker
script:
- export FULL_IMAGE_ID=${DOCKER_REGISTRY}/st4sd-registry-backend:$TRAVIS_BRANCH
- ./build_and_push.sh $FULL_IMAGE_ID
- stage: "Build test image pr"
os: linux
services:
- docker
script:
- export FULL_IMAGE_ID=${DOCKER_REGISTRY}/st4sd-registry-backend:$TRAVIS_PULL_REQUEST_BRANCH
- ./build_and_push.sh $FULL_IMAGE_ID
- stage: "Build production image"
os: linux
services:
- docker
script:
- export FULL_IMAGE_ID=${DOCKER_REGISTRY}/st4sd-registry-backend
- ./build_and_push.sh $FULL_IMAGE_ID
- stage: "Build platform image"
os: linux
services:
- docker
script:
- export FULL_IMAGE_ID=${DOCKER_REGISTRY}/st4sd-registry-backend:release-candidate
- ./build_and_push.sh $FULL_IMAGE_ID