This repository has been archived by the owner on Feb 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
azure-pipelines.yml
104 lines (87 loc) · 2.88 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
---
name: Ansible Role Linux Kernel
trigger:
batch: true
branches:
include:
- master
tags:
include:
- "*"
paths:
exclude:
- "*.md"
- ".gitignore"
- "LICENSE"
pr: none
pool:
vmImage: ubuntu-20.04
jobs:
- job: tests
displayName: Tests
variables:
cacheDir: /tmp/.pipeline_cache
steps:
- checkout: self
fetchDepth: 1
path: ansible-role-linux-kernel # Must match role name in molecule/converge.yml
- task: Cache@2
inputs:
key: cache
path: $(cacheDir)
displayName: Cache packages
- script: |
echo "##vso[task.prependpath]$HOME/.local/bin"
pip install --disable-pip-version-check --cache-dir $(cacheDir)/.pip_packages -U ansible flake8 yamllint ansible-lint black bandit molecule-docker pytest-testinfra
displayName: Get dependencies
condition: always()
- script: flake8
displayName: Lint Python modules
condition: always()
- script: black . --check --diff
displayName: Check black style is applied
condition: always()
- script: bandit -r . -x ./molecule
displayName: Check Python security
condition: always()
- script: yamllint -s .
displayName: Lint YAML files
condition: always()
- script: ansible-lint .
displayName: Lint Ansible configuration
condition: always()
- script: molecule test
displayName: Test Ansible role
condition: always()
env:
ANSIBLE_DISPLAY_SKIPPED_HOSTS: "False"
ANSIBLE_FORCE_COLOR: "True"
ANSIBLE_FORKS: "30"
ANSIBLE_NOCOLOR": "False"
ANSIBLE_PIPELINING: "True"
ANSIBLE_SSH_ARGS: "-o ControlMaster=auto -o ControlPersist=60s"
ANSIBLE_STDOUT_CALLBACK: debug
- job:
displayName: Ansible Galaxy publish
dependsOn: tests
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags'), ne(variables['Build.Reason'], 'Schedule'))
variables:
- group: ansibleGalaxy
steps:
- checkout: none
- script: ansible-galaxy role import --token $(AnsibleGalaxyToken) --role-name accelize.linux_kernel Accelize ansible-role-linux-kernel
displayName: Publish role to Ansible Galaxy
- task: GitHubRelease@1
displayName: Publish GitHub release
inputs:
gitHubConnection: Accelize-application
repositoryName: $(Build.Repository.Name)
action: create
target: $(Build.SourceVersion)
tagSource: gitTag
tagPattern: '[0-9]+\.[0-9]+\.[0-9]+'
isPreRelease: contains($(libraryVersion.version), '-')
releaseNotesSource: inline
releaseNotesInline: Role Available on Ansible galaxy.
changeLogCompareToRelease: lastFullRelease
changeLogType: commitBased