Skip to content
This repository was archived by the owner on May 6, 2022. It is now read-only.

Commit 1fe0279

Browse files
author
Thulio Ferraz Assis
authored
fix: CI conditions (#91)
* fix: top-level conditional to trigger releases The condition being only on the stage does not seem to trigger a CI run. Signed-off-by: Thulio Ferraz Assis <[email protected]> * fix: free-spacing regex string and condition The free-spacing modifier does not work with literal '\n' characters. It turns out that when indenting multiple levels in the string, the convertion from YAML to string adds the '\n' characters. Comments in the regex (# comment) also breaks it, matching conditions that should not be matched. Tested this approach with the travis-conditions CLI tool. Also, this commit fixes the top-level condition interaction with the release stage condition. Signed-off-by: Thulio Ferraz Assis <[email protected]> * feat: build on forks and add explanatory comment Signed-off-by: Thulio Ferraz Assis <[email protected]>
1 parent fded764 commit 1fe0279

File tree

1 file changed

+22
-24
lines changed

1 file changed

+22
-24
lines changed

.travis.yml

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,27 @@ go: 1.14.x
44
os: linux
55
dist: bionic
66

7+
# Don't indent any line more than one level to avoid '\n' characters in the converter string,
8+
# which breaks the regex free-spacing modifier. Also, do NOT include comments in the regex string.
9+
# The logic:
10+
# * Build on push to branches on forks that setup Travis - not tied to the
11+
# kubernetes-sigs/minibroker Travis account.
12+
# * Build on branch master that is not tagged.
13+
# * Build on kubernetes-sigs/minibroker when a tag is present and the branch matches a semver
14+
# string.
15+
if: >-
16+
(repo != "kubernetes-sigs/minibroker")
17+
OR ((branch = master) AND (tag IS NOT present))
18+
OR (
19+
(repo = "kubernetes-sigs/minibroker")
20+
AND (tag IS present)
21+
AND (branch ~= /^(?x)
22+
v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)
23+
(?:-((?:0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?
24+
(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?
25+
$/)
26+
)
27+
728
cache:
829
directories:
930
- ${HOME}/assets
@@ -60,27 +81,4 @@ stages:
6081
- test
6182
- test-integration
6283
- name: release
63-
if: >-
64-
(repo = "kubernetes-sigs/minibroker") AND
65-
(tag IS present) AND
66-
(branch ~= /^(?x)
67-
v(0|[1-9][0-9]*) # major
68-
\.
69-
(0|[1-9][0-9]*) # minor
70-
\.
71-
(0|[1-9][0-9]*) # patch
72-
(?:
73-
- # pre-release
74-
(
75-
(?:0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)
76-
(?:\.
77-
(?:0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)
78-
)*
79-
)
80-
)?
81-
# build
82-
(?:\+([0-9a-zA-Z-]+
83-
(?:\.[0-9a-zA-Z-]+)*
84-
)
85-
)?
86-
$/)
84+
if: (repo = "kubernetes-sigs/minibroker") AND (tag IS present) AND (branch != master)

0 commit comments

Comments
 (0)