forked from variacode/rundeck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
177 lines (157 loc) · 7.27 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
language: java
env: MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=192m" GRADLE_OPTS="-Xmx1024m -XX:MaxPermSize=192m"
TERM="dumb"
jdk:
- oraclejdk8
sudo: required
services:
- docker
stages:
- name: build
if: fork = false
- name: test
if: fork = false
- name: snapshot release
if: fork = false AND type = push AND (branch = master OR env(RUNDECK_RELEASE) IS present) AND tag IS blank
- name: tag release
if: fork = false AND type = push AND tag =~ ^v
- name: fork
if: fork = true
before_cache:
- rm -f gradle-cache/caches/modules-2/modules-2.lock
- rm -fr gradle-cache/caches/*/plugin-resolution/
cache:
directories:
- gradle-cache/wrapper/
- gradle-cache/caches/
before_install:
- sudo apt-get update -qq
- sudo apt-get install -y jq xmlstarlet
- sudo chsh --shell $(which bash)
- pip install awscli --upgrade --user
install: true
before_script:
- source scripts/travis-helpers.sh
- export -f travis_nanoseconds
- export -f travis_fold
- export -f travis_time_start
- export -f travis_time_finish
jobs:
include:
# Stage: build
- stage: build
script:
# Build artifacts: jars, wars, and docker images
- script_block 'build' 'bash scripts/travis-build.sh'
- script_block 'build.docker.rdtest' build_rdtest
# Copy artifacts and upload to s3
- mkdir -p artifacts/packaging
- mkdir -p artifacts/rundeckapp/build
- find ./packaging -regex '.*\.\(deb\|rpm\)' -exec cp --parents {} artifacts \;
- cp -r --parents core/build/libs artifacts/
- cp -r --parents rundeckapp/**/build/libs artifacts/
- cp -r --parents rundeck-storage/**/build/libs artifacts/
# Sync artifacts and trigger downstream snapshot builds if appropriate
- script_block 'sync-artifacts' sync_to_s3
- script_block 'trigger.downstream' trigger_downstream_snapshots
# Trigger rundeck/testdeck build
- script_block 'travis-trigger.testdeck' 'trigger_travis_build "${TRAVIS_OSS_TOKEN}" org rundeck testdeck ${RUNDECK_BRANCH} || true'
# Stage: test
- stage: test
env: JOB='Test Grails'
script:
- script_block 'sync-artifacts' fetch_common_artifacts
- script_block 'grails-test' './gradlew -g gradle-cache --build-cache test'
- env: JOB='Docker API tests'
script:
- script_block 'sync-artifacts' fetch_common_artifacts
- script_block 'docker.pull' pull_rdtest
- script_block 'api-test' 'DOCKER_COMPOSE_SPEC=docker-compose-api-mysql.yaml bash test/run-docker-api-tests.sh'
- stage: test
env: JOB='Test deb install'
script:
- script_block 'sync-artifacts' fetch_common_artifacts
- script_block 'deb-test' 'bash test/test-docker-install-deb.sh'
- env: JOB='Test rpm install'
script:
- script_block 'sync-artifacts' fetch_common_artifacts
- script_block 'rpm-test' 'bash test/test-docker-install-rpm.sh'
- env: JOB='Docker tests'
script:
- script_block 'sync-artifacts' fetch_common_artifacts
- script_block 'docker.pull' pull_rdtest
- script_block 'docker-test' 'bash test/run-docker-tests.sh'
- env: JOB='Docker SSL tests'
script:
- script_block 'sync-artifacts' fetch_common_artifacts
- script_block 'docker.pull' pull_rdtest
- script_block 'docker-ssl-test' 'bash test/run-docker-ssl-tests.sh'
- env: JOB='Docker Ansible tests'
script:
- script_block 'sync-artifacts' fetch_common_artifacts
- script_block 'docker.pull' pull_rdtest
- script_block 'docker-ansible-test' 'bash test/run-docker-ansible-tests.sh'
# # Stage: snapshot release publishes snapshot artifacts to external repositories
- stage: snapshot release
script:
# Sync artifacts under commit so we can use them for tag releases
- script_block 'sync.artifacts' fetch_common_artifacts
- script_block 'sync.commit' sync_commit_to_s3
- export VCS_URL=https://github.com/rundeck/rundeck.git
# Delete existing packages
- script_block 'delete.deb' 'bash scripts/delete-bintray-package.sh "${BINTRAY_USER}" "${BINTRAY_API_KEY}" rundeck ci-snapshot-deb rundeck'
- script_block 'delete.rpm-rundeck' 'bash scripts/delete-bintray-package.sh "${BINTRAY_USER}" "${BINTRAY_API_KEY}" rundeck ci-staging-rpm rundeck'
- script_block 'delete.mavan-rpm-config' 'bash scripts/delete-bintray-package.sh "${BINTRAY_USER}" "${BINTRAY_API_KEY}" rundeck ci-staging-rpm rundeck-config'
# Deploy new snapshot packages
- script_block 'publish.deb' 'bash scripts/deploy-deb-snapshots.sh "${BINTRAY_USER}" "${BINTRAY_API_KEY}" rundeck ci-snapshot-deb'
- script_block 'publish.rpm' 'bash scripts/deploy-rpm-snapshots.sh "${BINTRAY_USER}" "${BINTRAY_API_KEY}" rundeck ci-staging-rpm'
- script_block 'publish.maven' 'bash scripts/deploy-maven-snapshots.sh "${BINTRAY_USER}" "${BINTRAY_API_KEY}" rundeck ci-snapshot-maven "${RUNDECK_BUILD_NUMBER}"'
# Seal artifacts
- script_block 'seal-artifacts' seal_artifacts
# Stage: tag release publishes artifacts to the appropriate external repsositories
- stage: tag release
script:
- script_block 'sync-artifacts' fetch_common_artifacts
- script_block 'sync.ci-resources' fetch_common_resources
- export VCS_URL=https://github.com/rundeck/rundeck.git
# Deploy new snapshot packages
- bash scripts/deploy-deb-snapshots.sh "${BINTRAY_USER}" "${BINTRAY_API_KEY}" rundeck "${BINTRAY_DEB_REPO}"
- bash scripts/deploy-rpm-snapshots.sh "${BINTRAY_USER}" "${BINTRAY_API_KEY}" rundeck "${BINTRAY_RPM_REPO}"
- bash scripts/deploy-maven-snapshots.sh "${BINTRAY_USER}" "${BINTRAY_API_KEY}" rundeck "${BINTRAY_MAVEN_REPO}"
# Upload to sonatype
- export RELEASE_OPTS="-Psigning.keyId=${RUNDECK_SIGNING_KEYID} -Psigning.password=${RUNDECK_SIGNING_PASSWORD} -PsonatypeUsername=${SONATYPE_USERNAME} -PsonatypePassword=${SONATYPE_PASSWORD} -Poss-releases.username=${OSS_RELEASES_USERNAME} -Poss-releases.password=${OSS_RELEASES_PASSWORD} -Poss-releases.url=https://oss.sonatype.org/index.html#stagingRepositories -Psigning.secretKeyRingFile=$(pwd)/ci-resources/secring.gpg"
- script_block 'build.artifacts' 'bash jenkins-build.sh upload "${RUNDECK_RELEASE_TAG}"'
# Stage: fork consolidates all tests into one job.
# Forks do not have access to encrypted envars so we can't pass artifacts between jobs/stages.
- stage: fork
script:
- script_block 'gradle-build' './gradlew clean && ./gradlew build'
- script_block 'groovy-test' 'groovy testbuild.groovy -gradle'
- script_block 'make' 'make TAG=SNAPSHOT BUILD_NUM=$RUNDECK_BUILD_NUMBER rpm deb'
- script_block 'deb-test' 'bash test/test-docker-install-deb.sh'
- script_block 'rpm-test' 'bash test/test-docker-install-rpm.sh'
- script_block 'api-test' 'DOCKER_COMPOSE_SPEC=docker-compose-api-mysql.yaml bash test/run-docker-api-tests.sh'
- script_block 'docker-test' 'bash test/run-docker-tests.sh'
- script_block 'docker-ssl-test' 'bash test/run-docker-ssl-tests.sh'
- script_block 'docker-ansible-test' 'bash test/run-docker-ansible-tests.sh'
addons:
hostname: rdbuild
apt:
packages:
- groovy
- rpm
- make
- zip
- unzip
- fakeroot
branches:
only:
- master
- release-2.11
- prerelease-2.12.0
- /^v.*/
notifications:
irc:
- irc.freenode.org#rundeck
slack:
secure: ep3APeVD6QwEkTJ8YR0f1eDzcFJ2uLUIci4Aob/5ILm+v8h0hOTAe1yFoKv+iR/4PCeZ+5PvVezOMHSkFNX7rCj06Mj/ivlnng569JLjOQAR0q25aeIH+wy4oDE33HaNbNOYLMe7bXDP4SelRi9SbRRe84j6OjDgZzyDC36cyAk=