Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: replace Travis CI with GitLab CI #275

Merged
merged 45 commits into from
Dec 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
65ca911
docs(pre-commit): fix `rstcheck` violations & add `pre-commit` info
myii Dec 12, 2020
b0a854c
feat(gitlab-ci): manage across formulas
myii Dec 11, 2020
619aaee
feat(yamllint): add `.cache/` to ignores (to use in GitLab CI)
myii Dec 12, 2020
887ff39
feat(pre-commit_semantic-release.sh): install `m2r` without `sudo`
myii Dec 12, 2020
a821435
feat(release.config.js): use parent repo for `repositoryUrl`
myii Dec 12, 2020
3f612cf
feat(template): review PR 207
myii Dec 14, 2020
af7d43b
feat(template): review PR 209
myii Dec 14, 2020
6b9e83a
feat(template): disable CI failures (e.g. EOL)
myii Dec 14, 2020
0c52724
feat(docker): review PR 256 & defer CI testing until solution found
myii Dec 16, 2020
cf3a4fb
feat(travis): provide curtailed `.travis.yml` for reference purposes
myii Dec 11, 2020
a96c71a
feat(platforms_matrix_osfamily_debian): disable CI failures (e.g. EOL)
myii Dec 14, 2020
d1459fd
feat(arvados): review PRs 8, 9 & 10
myii Dec 14, 2020
3ec8673
feat(arvados): disable CI failures (e.g. EOL)
myii Dec 16, 2020
9be4992
feat(platforms_matrix_without_arch): disable CI failures (e.g. EOL)
myii Dec 14, 2020
7dd0b61
feat(platforms_matrix): disable CI failures (e.g. EOL)
myii Dec 14, 2020
d502105
feat(epel): disable CI failures (e.g. EOL)
myii Dec 14, 2020
9520f43
feat(dhcpd): disable CI failures (e.g. EOL)
myii Dec 14, 2020
c00623c
feat(collectd): disable CI failures (e.g. EOL)
myii Dec 14, 2020
431f964
feat(redis): review PR 85
myii Dec 14, 2020
2906da7
feat(redis): disable CI failures (e.g. EOL)
myii Dec 14, 2020
f725bf6
feat(jetbrains): disable CI failures (e.g. EOL)
myii Dec 14, 2020
aa0d714
feat(fail2ban): disable CI failures (e.g. EOL)
myii Dec 14, 2020
f77527c
feat(keepalived): disable CI failures (e.g. EOL)
myii Dec 14, 2020
e59d8b3
feat(locale): disable CI failures (e.g. EOL)
myii Dec 14, 2020
ba55b7a
feat(deepsea): disable CI failures (e.g. EOL)
myii Dec 14, 2020
decda2e
feat(mongodb): disable CI failures (e.g. EOL)
myii Dec 14, 2020
2aa5466
feat(openldap): disable CI failures (e.g. EOL)
myii Dec 14, 2020
e04739d
feat(rabbitmq): disable CI failures (e.g. EOL)
myii Dec 14, 2020
582622e
feat(rkhunter): disable CI failures (e.g. EOL)
myii Dec 14, 2020
090ed85
feat(stunnel): disable CI failures (e.g. EOL)
myii Dec 14, 2020
51092ec
feat(rspamd): disable CI failures (e.g. EOL)
myii Dec 14, 2020
1779b88
feat(php): disable CI failures (e.g. EOL)
myii Dec 14, 2020
c66a48d
feat(suricata): disable CI failures (e.g. EOL)
myii Dec 14, 2020
7c16183
feat(telegraf): disable CI failures (e.g. EOL)
myii Dec 14, 2020
0df8214
feat(nginx): disable CI failures (e.g. EOL)
myii Dec 14, 2020
7ed56ff
feat(users): disable CI failures (e.g. EOL)
myii Dec 14, 2020
e51c882
feat(varnish): disable CI failures (e.g. EOL)
myii Dec 14, 2020
dde4c9a
feat(vault): disable CI failures (e.g. EOL)
myii Dec 14, 2020
ae5d5b2
feat(eclipse): disable CI failures (e.g. EOL)
myii Dec 14, 2020
63e2b42
feat(salt): adjust matrix to remove Fluorine `2019.2`
myii Dec 14, 2020
10e2af7
feat(tomcat): disable CI failures (e.g. EOL)
myii Dec 15, 2020
ccb5525
feat(lvm): defer CI testing until solution found
myii Dec 16, 2020
c11fc0c
feat(iscsi): defer CI testing until solution found
myii Dec 16, 2020
1c62386
feat(icinga2): defer CI testing until solution found
myii Dec 16, 2020
e8deac3
feat(ssf): use TOFS override for `CONTRIBUTING` document
myii Dec 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
###############################################################################
# Define all YAML node anchors
###############################################################################
.node_anchors:
# `only` (also used for `except` where applicable)
only_branch_master_parent_repo: &only_branch_master_parent_repo
- 'master@myii/ssf-formula'
# `stage`
stage_lint: &stage_lint 'lint'
stage_release: &stage_release 'release'
# `image`
image_commitlint: &image_commitlint 'myii/ssf-commitlint:11'
image_precommit: &image_precommit
name: 'myii/ssf-pre-commit:2.9.2'
entrypoint: ['/bin/bash', '-c']
image_semantic-release: &image_semanticrelease 'myii/ssf-semantic-release:15.14'

###############################################################################
# Define stages and global variables
###############################################################################
stages:
- *stage_lint
- *stage_release
variables:
DOCKER_DRIVER: 'overlay2'

###############################################################################
# `lint` stage: `commitlint` & `pre-commit`
###############################################################################
commitlint:
stage: *stage_lint
image: *image_commitlint
script:
# Add `upstream` remote to get access to `upstream/master`
- 'git remote add upstream ${CI_PROJECT_URL}.git'
- 'git fetch --all'
# Set default commit hashes for `--from` and `--to`
- 'export COMMITLINT_FROM="$(git merge-base upstream/master HEAD)"'
- 'export COMMITLINT_TO="${CI_COMMIT_SHA}"'
# `coqbot` adds a merge commit to test PRs on top of the latest commit in
# the repo; amend this merge commit message to avoid failure
- |
if [ "${GITLAB_USER_LOGIN}" = "coqbot" ] \
&& [ "${CI_COMMIT_BRANCH}" != "master" ]; then
git commit --amend -m \
'chore: reword coqbot merge commit message for commitlint'
export COMMITLINT_TO=HEAD
fi
# Run `commitlint`
- 'commitlint --from "${COMMITLINT_FROM}"
--to "${COMMITLINT_TO}"
--verbose'

pre-commit:
stage: *stage_lint
image: *image_precommit
# https://pre-commit.com/#gitlab-ci-example
variables:
PRE_COMMIT_HOME: '${CI_PROJECT_DIR}/.cache/pre-commit'
cache:
key: '${CI_JOB_NAME}'
paths:
- '${PRE_COMMIT_HOME}'
script:
- 'pre-commit run --all-files --color always --verbose'

###############################################################################
# `release` stage: `semantic-release`
###############################################################################
semantic-release:
only: *only_branch_master_parent_repo
stage: *stage_release
image: *image_semanticrelease
variables:
MAINTAINER_TOKEN: '${GH_TOKEN}'
script:
# Update `AUTHORS.md`
- '${HOME}/go/bin/maintainer contributor'
# Run `semantic-release`
- 'semantic-release'
100 changes: 0 additions & 100 deletions .travis.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ extends: 'default'
# 4. All Jinja templates under `ssf/files/` (result in `yamllint` syntax errors)
# Not disabling via. `*.yml` since we may end up with non-Jinja YAML files here
ignore: |
.cache/
node_modules/
test/**/states/**/*.sls
.kitchen/
ssf/files/default/.cirrus.yml
ssf/files/default/.gitlab-ci.yml
ssf/files/default/.pre-commit-config.yaml
ssf/files/default/.rubocop.yml
ssf/files/default/.salt-lint
Expand Down
19 changes: 17 additions & 2 deletions docs/CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The entire process relies on the structure of commit messages to determine the v
Full details are available in the upstream docs regarding the `Angular Commit Message Conventions <https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines>`_.
The key factor is that the first line of the commit message must follow this format:

.. code-block::
.. code-block:: console

type(scope): subject

Expand All @@ -55,6 +55,22 @@ So based on the example above:
* The ``(scope):`` will be shown in bold text without the brackets.
* The ``subject`` follows the ``scope`` as standard text.

pre-commit
^^^^^^^^^^

`pre-commit <https://pre-commit.com/>`_ is configured for this formula, which you may
optionally use to ease the steps involved in submitting your changes, including
checking the formatting of your commit messages.

First install the ``pre-commit`` package manager locally using the appropriate
`method <https://pre-commit.com/#installation>`_, then run ``bin/install-hooks`` in the
formula's root directory and now ``pre-commit`` will run automatically on each
``git commit``. ::

$ bin/install-hooks
pre-commit installed at .git/hooks/pre-commit
pre-commit installed at .git/hooks/commit-msg

Linting commit messages in Travis CI
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down Expand Up @@ -156,4 +172,3 @@ An example of that:
BREAKING CHANGE: With the removal of all of the `.sls` files under
`template package`, this formula no longer supports the installation of
packages.

6 changes: 3 additions & 3 deletions docs/TOFS_pattern.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Example: NTP before applying TOFS

Let's work with the NTP example. A basic formula that follows the `design guidelines <http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html>`_ has the following files and directories tree:

.. code-block::
.. code-block:: console

/srv/saltstack/salt-formulas/ntp-saltstack-formula/
ntp/
Expand Down Expand Up @@ -226,7 +226,7 @@ We can make different templates coexist for different minions, classified by any

If we decide that we want ``os_family`` as switch, then we could provide the formula template variants for both the ``RedHat`` and ``Debian`` families.

.. code-block::
.. code-block:: console

/srv/saltstack/salt-formulas/ntp-saltstack-formula/ntp/files/
default/
Expand Down Expand Up @@ -449,7 +449,7 @@ Using sub-directories for ``components``

If your formula is composed of several components, you may prefer to provides files under sub-directories, like in the `systemd-formula <https://github.com/saltstack-formulas/systemd-formula>`_.

.. code-block::
.. code-block:: console

/srv/saltstack/systemd-formula/
systemd/
Expand Down
1 change: 1 addition & 0 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ ssf:
- inspec/README.md
- .gitignore
- .cirrus.yml
- .gitlab-ci.yml
- .pre-commit-config.yaml
- .rstcheck.cfg
- .rubocop.yml
Expand Down
2 changes: 1 addition & 1 deletion pre-commit_semantic-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ sed -i -e "s_^\(version:\).*_\1 ${1}_" FORMULA
###############################################################################

# Install `m2r`
sudo -H pip install m2r
pip3 install m2r

# Copy and then convert the `.md` docs
cp ./*.md docs/
Expand Down
1 change: 1 addition & 0 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = {
branch: 'master',
repositoryUrl: 'https://github.com/myii/ssf-formula',
plugins: [
['@semantic-release/commit-analyzer', {
preset: 'angular',
Expand Down
5 changes: 4 additions & 1 deletion ssf/config/formulas.sls
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,12 @@ prepare-git-branch-for-{{ formula }}:
{#- Or if the file is `libsaltcli.jinja` and `use_libsaltcli` is `False` #}
{#- Likewise, if running the state for TOFS files when `use_tofs` is `False` #}
{#- Also remove the local `CONTRIBUTING` file to use the org-level file instead #}
{#- Furthermore, remove `.travis.yml` for the `ssf-formula` #}
{%- if (semrel_file == '.cirrus.yml' and not use_cirrus_ci) or
(semrel_file == 'formula/libsaltcli.jinja' and not use_libsaltcli) or
(semrel_file in ['docs/TOFS_pattern.rst', 'formula/libtofs.jinja'] and not use_tofs) or
(semrel_file in ['docs/CONTRIBUTING.rst'] and formula not in ['.github', 'ssf-formula'])
(semrel_file in ['docs/CONTRIBUTING.rst'] and formula not in ['.github', 'ssf-formula']) or
(semrel_file in ['.travis.yml'] and formula in ['ssf-formula'])
%}
{%- set add_or_rm = ['rm', 'remove', 'absent'] %}
{%- endif %}
Expand Down Expand Up @@ -134,6 +136,7 @@ prepare-git-branch-for-{{ formula }}:
owner: {{ owner }}
formula: {{ formula }}
codeowners: {{ context.codeowners | yaml }}
gitlab: {{ context.git.gitlab | yaml }}
inspec_suites_kitchen: {{ inspec_suites_kitchen | yaml }}
inspec_suites_matrix: {{ context.inspec_suites_matrix | yaml }}
kitchen: {{ context.kitchen | yaml }}
Expand Down
Loading