Skip to content

Commit

Permalink
Merge pull request #191 from myii/feat/push-travis-notifications-to-z…
Browse files Browse the repository at this point in the history
…ulip

feat(travis): push notifications to `saltstack-formulas.zulipchat.com`
  • Loading branch information
myii authored May 21, 2020
2 parents 9907567 + a1e50da commit fa3a349
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 5 deletions.
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,15 @@ jobs:
edge: true
# Run `semantic-release`
script: 'npx semantic-release@15.14'

# Notification options: `always`, `never` or `change`
notifications:
webhooks:
if: 'repo = myii/ssf-formula'
urls:
- https://saltstack-formulas.zulipchat.com/api/v1/external/travis?api_key=HsIq3o5QmLxdnVCKF9is0FUIpkpAY79P&stream=CI&topic=myii%2Fssf-formula&ignore_pull_requests=false
on_success: always # default: always
on_failure: always # default: always
on_start: always # default: never
on_cancel: always # default: always
on_error: always # default: always
2 changes: 1 addition & 1 deletion .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ignore: |
ssf/files/default/.yamllint
ssf/files/default/kitchen.yml
ssf/files/default/inspec/inspec.yml
ssf/files/tofs_ssf-formula/.travis.yml
ssf/files/tofs_arvados-formula/.travis.yml
ssf/files/tofs_ssf-formula/.yamllint
yaml-files:
Expand Down
4 changes: 3 additions & 1 deletion ssf/config/formulas.sls
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
{%- set use_cirrus_ci = context.use_cirrus_ci %}
{%- set use_libsaltcli = context.use_libsaltcli %}
{%- set use_tofs = context.use_tofs %}
{%- set owner = context.git.github.owner %}
{%- set formula = context.git.github.repo %}
{#- Determine the TOFS override directory for the current formula #}
{#- Can't use `formula` directly because some formula names are used as top-level pillar/config keys, such as `users-formula` #}
Expand Down Expand Up @@ -125,6 +126,7 @@ prepare-git-branch-for-{{ formula }}:
{#- Maintaining the rest for consistency #}
tplroot: {{ tplroot }}
semrel_formula: {{ semrel_file_specs.alt_semrel_formula | d(semrel_formula) }}
owner: {{ owner }}
formula: {{ formula }}
codeowners: {{ context.codeowners | yaml }}
inspec_suites_kitchen: {{ inspec_suites_kitchen | yaml }}
Expand Down Expand Up @@ -208,7 +210,7 @@ create-github-PR-for-{{ formula }}:
- cwd: {{ ssf.formulas_path }}/{{ formula }}/
- args: >-
create-github-PR-for-{{ formula }}
{{ context.git.github.owner }}
{{ owner }}
{{ formula }}
{{ context.git.branch.base }}
{{ ssf.git.github.user }}
Expand Down
4 changes: 2 additions & 2 deletions ssf/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ ssf_node_anchors:
# An alternative method could be to use:
# `git describe --abbrev=0 --tags`
# yamllint disable rule:line-length rule:quoted-strings
title: "ci(kitchen+travis): adjust matrix to add '`'3000.3'`'"
body: '* Semi-automated using https://github.com/myii/ssf-formula/pull/190'
title: "ci(travis): add notifications ='>' zulip [skip ci]"
body: '* Automated using https://github.com/myii/ssf-formula/pull/191'
# yamllint enable rule:line-length rule:quoted-strings
github:
owner: 'saltstack-formulas'
Expand Down
26 changes: 26 additions & 0 deletions ssf/files/default/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,29 @@ jobs:
edge: true
# Run `semantic-release`
script: 'npx semantic-release@15.14'
{%- if semrel_formula == 'template' %}
# <REMOVEME
{%- endif %}

# Notification options: `always`, `never` or `change`
{#- TODO: Move this to `defaults.yaml` & `formulas.yaml` #}
{%- set ignore_pull_requests = 'false' if semrel_formula in ['ssf'] else 'true' %}
notifications:
webhooks:
if: 'repo = {{ owner }}/{{ formula }}'
urls:
- {{ 'https://{}/api/v1/external/travis?{}&{}&{}&{}'.format(
'saltstack-formulas.zulipchat.com',
'api_key=HsIq3o5QmLxdnVCKF9is0FUIpkpAY79P',
'stream=CI',
'topic={}%2F{}'.format(owner, formula),
'ignore_pull_requests={}'.format(ignore_pull_requests),
) }}
on_success: always # default: always
on_failure: always # default: always
on_start: always # default: never
on_cancel: always # default: always
on_error: always # default: always
{%- if semrel_formula == 'template' %}
# REMOVEME>
{%- endif %}
20 changes: 20 additions & 0 deletions ssf/files/tofs_arvados-formula/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,23 @@ jobs:
edge: true
# Run `semantic-release`
script: 'npx semantic-release@15.14'

# Notification options: `always`, `never` or `change`
{#- TODO: Move this to `defaults.yaml` & `formulas.yaml` #}
{%- set ignore_pull_requests = 'false' if semrel_formula in ['ssf'] else 'true' %}
notifications:
webhooks:
if: 'repo = {{ owner }}/{{ formula }}'
urls:
- {{ 'https://{}/api/v1/external/travis?{}&{}&{}&{}'.format(
'saltstack-formulas.zulipchat.com',
'api_key=HsIq3o5QmLxdnVCKF9is0FUIpkpAY79P',
'stream=CI',
'topic={}%2F{}'.format(owner, formula),
'ignore_pull_requests={}'.format(ignore_pull_requests),
) }}
on_success: always # default: always
on_failure: always # default: always
on_start: always # default: never
on_cancel: always # default: always
on_error: always # default: always
2 changes: 1 addition & 1 deletion ssf/formulas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3039,7 +3039,7 @@ ssf:
- ssf/files/default/.yamllint
- ssf/files/default/kitchen.yml
- ssf/files/default/inspec/inspec.yml
- ssf/files/tofs_ssf-formula/.travis.yml
- ssf/files/tofs_arvados-formula/.travis.yml
- ssf/files/tofs_ssf-formula/.yamllint
rules:
commas:
Expand Down

0 comments on commit fa3a349

Please sign in to comment.