Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 10 additions & 0 deletions renovate/ansible.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"description": "Ansible task and Galaxy dependency updates",
"ansible": {
"enabled": true,
},
"ansible-galaxy": {
"enabled": true,
},
}
1 change: 1 addition & 0 deletions renovate/default.json5
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"github>LizardByte/.github//renovate/themerr.json5",
// Apply common defaults before ecosystem grouping overrides.
"github>LizardByte/.github//renovate/common.json5",
"github>LizardByte/.github//renovate/ansible.json5",
"github>LizardByte/.github//renovate/conda.json5",
"github>LizardByte/.github//renovate/docker.json5",
"github>LizardByte/.github//renovate/github-actions.json5",
Expand Down
43 changes: 43 additions & 0 deletions tests/renovate-config.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import JSON5 from 'json5';
import {api as condaVersioning} from 'renovate/dist/modules/versioning/conda/index.js';
import {api as looseVersioning} from 'renovate/dist/modules/versioning/loose/index.js';
import {get as getVersioning} from 'renovate/dist/modules/versioning/index.js';
import {defaultConfig as ansibleDefaults, extractPackageFile as extractAnsiblePackageFile} from 'renovate/dist/modules/manager/ansible/index.js';
import {defaultConfig as ansibleGalaxyDefaults, extractPackageFile as extractAnsibleGalaxyPackageFile} from 'renovate/dist/modules/manager/ansible-galaxy/index.js';
import {extractPackageFile as extractCdnUrlPackageFile} from 'renovate/dist/modules/manager/cdnurl/index.js';
import {massageCustomDatasourceConfig} from 'renovate/dist/modules/datasource/custom/utils.js';
import {extractPackageFile as extractRegexPackageFile} from 'renovate/dist/modules/manager/custom/regex/index.js';
Expand Down Expand Up @@ -799,6 +801,45 @@ test('pins Jellyfin SDK and EF only in Themerr connector projects', async () =>
});


test('enables Ansible Docker image updates from task files', () => {
assert.equal(renovateConfig.ansible?.enabled, true);
const packageFile = 'roles/containers/tasks/main.yml';
assert.ok(matchesManagerFilePattern(packageFile, ansibleDefaults.managerFilePatterns));
const content = `
- name: Run nginx
community.docker.docker_container:
name: nginx
image: nginx:1.27.0
`;
const {deps} = extractAnsiblePackageFile(content, packageFile, renovateConfig.ansible);
assert.deepEqual(
deps.map(({depName, currentValue, datasource}) => ({depName, currentValue, datasource})),
[{depName: 'nginx', currentValue: '1.27.0', datasource: 'docker'}],
);
});

test('enables Ansible Galaxy collection updates from requirements.yml', () => {
assert.equal(renovateConfig['ansible-galaxy']?.enabled, true);
const packageFile = 'requirements.yml';
assert.ok(matchesManagerFilePattern(packageFile, ansibleGalaxyDefaults.managerFilePatterns));
const content = `
---
collections:
- name: ansible.posix
version: "1.6.2"
- name: ansible.windows
version: "2.8.0"
`;
const {deps} = extractAnsibleGalaxyPackageFile(content, packageFile);
assert.deepEqual(
deps.map(({depName, currentValue, datasource}) => ({depName, currentValue, datasource})),
[
{depName: 'ansible.posix', currentValue: '1.6.2', datasource: 'galaxy-collection'},
{depName: 'ansible.windows', currentValue: '2.8.0', datasource: 'galaxy-collection'},
],
);
});

test('resolves existing consumer entry points through all split presets', async () => {
const repositoryConfig = JSON.parse(fs.readFileSync('renovate.json', 'utf8'));
for (const inputConfig of [
Expand All @@ -810,6 +851,8 @@ test('resolves existing consumer entry points through all split presets', async
assert.deepEqual(config.packageRules, renovateConfig.packageRules);
assert.deepEqual(config.customManagers, renovateConfig.customManagers);
assert.deepEqual(config.customDatasources, renovateConfig.customDatasources);
assert.equal(config.ansible?.enabled, true);
assert.equal(config['ansible-galaxy']?.enabled, true);
assert.equal(config.timezone, 'America/New_York');
assert.equal(config.forkProcessing, inputConfig.forkProcessing);
}
Expand Down
Loading