Skip to content

Commit

Permalink
feat(gitlab-ci): implement allow_failure to be used for instances
Browse files Browse the repository at this point in the history
Introducing this so that Debian 11 can be introduced now throughout all
formulas.  For the most part, these instances are only failing because
the upstream repo hasn't been made available just yet; rather than
disabling Debian 11 instances, let them run and then use them as
standard instances once they start passing.
  • Loading branch information
myii committed Jul 18, 2021
1 parent 767cb2b commit 87e4244
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 7 deletions.
1 change: 1 addition & 0 deletions ssf/config/formulas.sls
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ remove-previous-file-location-for-{{ formula }}-{{ dest_file }}:
map_jinja: {{ map_jinja | yaml }}
platforms: {{ context.platforms | yaml }}
platforms_matrix: {{ context.platforms_matrix | yaml }}
platforms_matrix_allow_failure: {{ context.platforms_matrix_allow_failure | yaml }}
platforms_matrix_commented_includes: {{ context.platforms_matrix_commented_includes | yaml }}
proxyplatformswindows: {{ ssf.proxyplatformswindows | yaml }}
rubocop: {{ context.rubocop | yaml }}
Expand Down
3 changes: 3 additions & 0 deletions ssf/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ ssf_node_anchors:
# - [gentoo/stage3, 0 , master, 0, default]
# - [almalinux , 0 , master, 0, default]
# - [rockylinux , 0 , master, 0, default]
# Instances to allow failure for, such as new platforms which aren't
# currently working because waiting for upstream repos to be provided
platforms_matrix_allow_failure: []
# To deal with excessive instances when mimicking `kitchen list -b`
# If values are set, only use these as commented entries in the matrix
platforms_matrix_commented_includes: []
Expand Down
2 changes: 1 addition & 1 deletion ssf/files/default/.cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ docker_builder:
name: Test ${INSTANCE}
env:
matrix:
{{- format_ci_matrix(platforms, inspec_suites_kitchen, inspec_suites_matrix, platforms_matrix, platforms_matrix_commented_includes, semrel_formula, width=6) }}
{{- format_ci_matrix(platforms, inspec_suites_kitchen, inspec_suites_matrix, platforms_matrix, platforms_matrix_allow_failure, platforms_matrix_commented_includes, semrel_formula, width=6) }}
bundle_install_script: bundle install
verify_script:
{%- for pre_cmd in script_kitchen.pre %}
Expand Down
2 changes: 1 addition & 1 deletion ssf/files/default/.github/workflows/kitchen.vagrant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
fail-fast: false
matrix:
instance:
{{- format_ci_matrix(platforms, inspec_suites_kitchen, inspec_suites_matrix, platforms_matrix, platforms_matrix_commented_includes, semrel_formula, width=10, use_github_format=True, use_vagrant_platforms=True) }}
{{- format_ci_matrix(platforms, inspec_suites_kitchen, inspec_suites_matrix, platforms_matrix, platforms_matrix_allow_failure, platforms_matrix_commented_includes, semrel_formula, width=10, use_github_format=True, use_vagrant_platforms=True) }}
{%- raw %}
steps:
- name: 'Check out code'
Expand Down
2 changes: 1 addition & 1 deletion ssf/files/default/.github/workflows/kitchen.windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
fail-fast: false
matrix:
instance:
{{- format_ci_matrix(platforms, inspec_suites_kitchen, inspec_suites_matrix, platforms_matrix, platforms_matrix_commented_includes, semrel_formula, width=10, use_github_format=True, use_proxy_platforms_windows=platform) }}
{{- format_ci_matrix(platforms, inspec_suites_kitchen, inspec_suites_matrix, platforms_matrix, platforms_matrix_allow_failure, platforms_matrix_commented_includes, semrel_formula, width=10, use_github_format=True, use_proxy_platforms_windows=platform) }}
{%- raw %}
steps:
- name: 'Check out code'
Expand Down
2 changes: 1 addition & 1 deletion ssf/files/default/.github/workflows/kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fail-fast: false
matrix:
instance:
{{- format_ci_matrix(platforms, inspec_suites_kitchen, inspec_suites_matrix, platforms_matrix, platforms_matrix_commented_includes, semrel_formula, width=10, use_github_format=True) }}
{{- format_ci_matrix(platforms, inspec_suites_kitchen, inspec_suites_matrix, platforms_matrix, platforms_matrix_allow_failure, platforms_matrix_commented_includes, semrel_formula, width=10, use_github_format=True) }}
{%- raw %}
steps:
- name: 'Check out code'
Expand Down
14 changes: 12 additions & 2 deletions ssf/files/default/.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ rubocop:
###############################################################################
# Define `test` template
###############################################################################
.test_instance:
.test_instance:{{ ' &test_instance' if platforms_matrix_allow_failure else '' }}
stage: *stage_test
image: *image_dindruby
services: *services_docker_dind
Expand All @@ -148,6 +148,16 @@ rubocop:
# Alternative value to consider: `${CI_JOB_NAME}`
- '{{ script_kitchen.bin }} {{ script_kitchen.cmd }} "${DOCKER_ENV_CI_JOB_NAME}"'

{%- if platforms_matrix_allow_failure %}

###############################################################################
# Define `test` template (`allow_failure: true`)
###############################################################################
.test_instance_failure_permitted:
<<: *test_instance
allow_failure: true
{%- endif %}

{%- if semrel_formula == 'template' %}
# <REMOVEME

Expand Down Expand Up @@ -202,7 +212,7 @@ rubocop:
test-formula-conversion: {extends: '.test_conversion'}
# REMOVEME>
{%- endif %}
{{- format_ci_matrix(platforms, inspec_suites_kitchen, inspec_suites_matrix, platforms_matrix, platforms_matrix_commented_includes, semrel_formula, width=0, use_gitlab_format=True) }}
{{- format_ci_matrix(platforms, inspec_suites_kitchen, inspec_suites_matrix, platforms_matrix, platforms_matrix_allow_failure, platforms_matrix_commented_includes, semrel_formula, width=0, use_gitlab_format=True) }}
{%- endif %}

###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion ssf/files/default/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ jobs:
# Ref: https://github.com/saltstack-formulas/template-formula/issues/118
# Ref: https://github.com/saltstack-formulas/template-formula/issues/121
{%- endif %}
{{- format_ci_matrix(platforms, inspec_suites_kitchen, inspec_suites_matrix, platforms_matrix, platforms_matrix_commented_includes, semrel_formula, use_new_travis_format=True) }}
{{- format_ci_matrix(platforms, inspec_suites_kitchen, inspec_suites_matrix, platforms_matrix, platforms_matrix_allow_failure, platforms_matrix_commented_includes, semrel_formula, use_new_travis_format=True) }}
{%- endif %}

{%- if semrel_formula == 'template' %}
Expand Down
4 changes: 4 additions & 0 deletions ssf/libcimatrix.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
inspec_suites_kitchen,
inspec_suites_matrix,
platforms_matrix,
platforms_matrix_allow_failure,
platforms_matrix_commented_includes,
semrel_formula,
width=4,
Expand Down Expand Up @@ -184,6 +185,9 @@
{%- if use_gitlab_format %}
{%- set list_format = '' %}
{%- set test_template = ": {extends: '.test_instance'}" %}
{%- if [os, os_ver, salt_ver, py_ver, suite_name] in platforms_matrix_allow_failure %}
{%- set test_template = ": {extends: '.test_instance_failure_permitted'}" %}
{%- endif %}
{%- else %}
{%- set list_format = '- ' %}
{%- set test_template = "" %}
Expand Down

0 comments on commit 87e4244

Please sign in to comment.