From 10ef1ca5d0fb8454a7a51764f903f8246e89d98d Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Wed, 20 May 2020 08:12:19 +0100 Subject: [PATCH 1/2] fix(ssf): update `.yamllint` with current situation --- .yamllint | 2 +- ssf/formulas.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.yamllint b/.yamllint index a2cdc7f5..4518b249 100644 --- a/.yamllint +++ b/.yamllint @@ -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: diff --git a/ssf/formulas.yaml b/ssf/formulas.yaml index a604e968..5314b75b 100644 --- a/ssf/formulas.yaml +++ b/ssf/formulas.yaml @@ -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: From a1e50da971b187d9052a7d29b6de6998fbd48e8d Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Wed, 20 May 2020 08:29:21 +0100 Subject: [PATCH 2/2] feat(travis): push notifications to `saltstack-formulas.zulipchat.com` * Use `%2F` for the forward slash in the topic name: - https://docs.travis-ci.com/user/triggering-builds/ - https://www.degraeve.com/reference/urlencoding.php * Use Travis `if` conditional rather than `secret` encrypted enviroment variable workaround suggested: - Not a secret, just the bot's API key - Need to be able to modify parts of the URL in certain situations, such as the weekly `master` branch tests - References: + https://docs.travis-ci.com/user/environment-variables/#encrypting-environment-variables + https://github.com/travis-ci/travis-ci/issues/329 + https://github.com/travis-ci/travis-ci/issues/1094 + https://github.com/travis-ci/travis-ci/issues/5063 + https://github.com/travis-ci/travis-ci/issues/6100 + https://github.com/mozilla/build-tools/commit/c13a297 --- .travis.yml | 12 ++++++++++ ssf/config/formulas.sls | 4 +++- ssf/defaults.yaml | 4 ++-- ssf/files/default/.travis.yml | 26 ++++++++++++++++++++++ ssf/files/tofs_arvados-formula/.travis.yml | 20 +++++++++++++++++ 5 files changed, 63 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index afad4646..6e429969 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/ssf/config/formulas.sls b/ssf/config/formulas.sls index c8aafa76..a19a0e25 100644 --- a/ssf/config/formulas.sls +++ b/ssf/config/formulas.sls @@ -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` #} @@ -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 }} @@ -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 }} diff --git a/ssf/defaults.yaml b/ssf/defaults.yaml index 5279f82a..5c78908d 100644 --- a/ssf/defaults.yaml +++ b/ssf/defaults.yaml @@ -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' diff --git a/ssf/files/default/.travis.yml b/ssf/files/default/.travis.yml index d3e6ffd3..50f50b25 100644 --- a/ssf/files/default/.travis.yml +++ b/ssf/files/default/.travis.yml @@ -226,3 +226,29 @@ jobs: edge: true # Run `semantic-release` script: 'npx semantic-release@15.14' +{%- if semrel_formula == 'template' %} +# +{%- endif %} diff --git a/ssf/files/tofs_arvados-formula/.travis.yml b/ssf/files/tofs_arvados-formula/.travis.yml index da56128b..0930d1b3 100644 --- a/ssf/files/tofs_arvados-formula/.travis.yml +++ b/ssf/files/tofs_arvados-formula/.travis.yml @@ -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