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

Commit

Permalink
fix: CI conditions (#91)
Browse files Browse the repository at this point in the history
* 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 <thulio.assis@suse.com>

* 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 <thulio.assis@suse.com>

* feat: build on forks and add explanatory comment

Signed-off-by: Thulio Ferraz Assis <thulio.assis@suse.com>
  • Loading branch information
Thulio Ferraz Assis authored Jul 24, 2020
1 parent fded764 commit 1fe0279
Showing 1 changed file with 22 additions and 24 deletions.
46 changes: 22 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,27 @@ go: 1.14.x
os: linux
dist: bionic

# Don't indent any line more than one level to avoid '\n' characters in the converter string,
# which breaks the regex free-spacing modifier. Also, do NOT include comments in the regex string.
# The logic:
# * Build on push to branches on forks that setup Travis - not tied to the
# kubernetes-sigs/minibroker Travis account.
# * Build on branch master that is not tagged.
# * Build on kubernetes-sigs/minibroker when a tag is present and the branch matches a semver
# string.
if: >-
(repo != "kubernetes-sigs/minibroker")
OR ((branch = master) AND (tag IS NOT present))
OR (
(repo = "kubernetes-sigs/minibroker")
AND (tag IS present)
AND (branch ~= /^(?x)
v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)
(?:-((?: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-]*))*))?
(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?
$/)
)
cache:
directories:
- ${HOME}/assets
Expand Down Expand Up @@ -60,27 +81,4 @@ stages:
- test
- test-integration
- name: release
if: >-
(repo = "kubernetes-sigs/minibroker") AND
(tag IS present) AND
(branch ~= /^(?x)
v(0|[1-9][0-9]*) # major
\.
(0|[1-9][0-9]*) # minor
\.
(0|[1-9][0-9]*) # patch
(?:
- # pre-release
(
(?: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-]*)
)*
)
)?
# build
(?:\+([0-9a-zA-Z-]+
(?:\.[0-9a-zA-Z-]+)*
)
)?
$/)
if: (repo = "kubernetes-sigs/minibroker") AND (tag IS present) AND (branch != master)

0 comments on commit 1fe0279

Please sign in to comment.