forked from stolostron/discovery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
94 lines (86 loc) · 3.92 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
# Copyright Contributors to the Open Cluster Management project
#
# Sample .travis.yml using the mvp-helloworld image (a helmoperator)
#
os:
- linux
language: go
go:
- "1.15.x"
services:
- docker
addons:
sonarcloud:
organization: "open-cluster-management"
token:
secure: "CzdZGPhURVw7ORf6uYewWP9izplB2TgGk0EShh9NEKfS+6+MQZzHq/WMmkU4XhShpdDm+wix5Gcw4wPBgrHgodHJpqnBGd97q6Lz2Y1pHnNULfh1Gp4sxSqZfDBRkA2XQ7bLTBk/puXg58mJPjhjcwFrZCF3B9l3jdm3nRFLpvN1hLfxjFCxHh4WVwuvVOlTG/PPFII7JXX15vPbHkdVfsnfJSfHzeSfszHi6B1jB5kyGdcJHpS1jImsXU6OoWJIP00mIxCYOGPB6ryp3DjoPzlz7arv31A2q0/ZSZt7Fx9NFySoeo5eJ//vusRklHuI04j1N3PAUW/z7FDwXQCGRhynW+wVDq+ACLUf7th2UnA142HQoe7so3xmCyaPeyt1z4Ayo4MQbqwzRPOcdpWlVBtH9MKzjnYXBpBETYziM5xwODbAdqSmKKsJVHLkX31rY2Dw2oQcuLh6ESNMsVeEsVUD8pMuVYfnj0UsYHlFtO0A5noOp2KeANsQAru076gKBG6eKSRXIhsUDPGOiHxnIWQWJxAaot8wf91mdtm8MO6SnbRTovqV8M8FgXIKyz9x8khDhGSiqOohtZW2SISeUPqW7wgHnHtNtz8nSiu6EQTpK9XL/UbOMOq2q8jRC7pxK+IY9150l9YKwna4s6emjUo/zMq/V05AqkrjEd5wq+Q="
env:
global:
# Required
- OS=linux
- COMPONENT_TAG_EXTENSION="-${TRAVIS_COMMIT}"
- COMPONENT_NAME=discovery-operator
# Component Specific
- COMPONENT_INIT_COMMAND=${TRAVIS_BUILD_DIR}/cicd-scripts/install-dependencies.sh
- COMPONENT_BUILD_COMMAND=${TRAVIS_BUILD_DIR}/cicd-scripts/build.sh
- COMPONENT_UNIT_TEST_COMMAND=${TRAVIS_BUILD_DIR}/cicd-scripts/unit-test.sh
- COMPONENT_DEPLOY_COMMAND=${TRAVIS_BUILD_DIR}/cicd-scripts/deploy-to-cluster.sh
- COMPONENT_E2E_TEST_COMMAND=${TRAVIS_BUILD_DIR}/cicd-scripts/e2e-test.sh
stages:
- build
- unit-test
- test-e2e
- release-ff
- publish
jobs:
include:
- stage: build
name: "Build the test image and push it"
script:
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then export COMPONENT_TAG_EXTENSION="-PR${TRAVIS_PULL_REQUEST}-${TRAVIS_COMMIT}"; fi;
- |
make
make component/build
make component/push
make security/scans
COMPONENT_NAME=discovery-operator-tests COMPONENT_BUILD_COMMAND=${TRAVIS_BUILD_DIR}/cicd-scripts/build-test-image.sh
make component/build
make component/push
- stage: unit-test
name: "Run unit tests"
script:
# Set the image tag differently for PRs
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then export COMPONENT_TAG_EXTENSION="-PR${TRAVIS_PULL_REQUEST}-${TRAVIS_COMMIT}"; fi;
# Bootstrap the build harness, pull test image, and run unit tests.
- |
make
make component/pull
make component/test/unit
make sonar/go
- stage: test-e2e
name: "Deploy the image to a cluster and run e2e tests"
if: type = pull_request
script:
#Check out a clusterpool, set up oc, deploy, run e2e tests, and return clusterpool cluster
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then export COMPONENT_TAG_EXTENSION="-PR${TRAVIS_PULL_REQUEST}-${TRAVIS_COMMIT}"; fi;
- |
make
make component/pull
make component/test/e2e
- stage: release-ff
name: "Push commits to current release branch"
if: type = push AND branch =~ /^main$/
script:
- make
- make release-ff
- stage: publish
name: "Publish the image to quay with an official version/sha tag and publish entry to integration pipeline stage"
if: type = push AND branch =~ /^release-[0-9]+\..*$/
script:
- |
make
make pipeline-manifest/update PIPELINE_MANIFEST_COMPONENT_SHA256=${TRAVIS_COMMIT} PIPELINE_MANIFEST_COMPONENT_REPO=${TRAVIS_REPO_SLUG} PIPELINE_MANIFEST_BRANCH=${TRAVIS_BRANCH}
rm -rf pipeline
echo "Waiting 60s before publishing test image..." && sleep 60
COMPONENT_NAME=discovery-operator-tests
make pipeline-manifest/update PIPELINE_MANIFEST_COMPONENT_SHA256=${TRAVIS_COMMIT} PIPELINE_MANIFEST_COMPONENT_REPO=${TRAVIS_REPO_SLUG} PIPELINE_MANIFEST_BRANCH=${TRAVIS_BRANCH}