This repository has been archived by the owner on Oct 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ability to install plugins from update.sonarsource.org has been…
… added (#38) * feat: ability to install plugins from update.sonarsource.org (marketplace) has been added * chore: debug information has been removed * chore: quotes and one assert insted of two * chore(tests): check for plugin installation from different sources * fix(tests): idempotence
- Loading branch information
Showing
8 changed files
with
84 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
- name: "{{ sonar_cplugin.name }} | Set current plugin's jar filename" | ||
set_fact: | ||
cplugin_fname: "{{ sonar_cplugin.name }}-{{ sonar_cplugin.version }}.jar" | ||
|
||
- name: "{{ sonar_cplugin.name }} | Set current plugins's custom download URL if available" | ||
set_fact: | ||
cplugin_url: "{{ sonar_cplugin.url }}" | ||
when: sonar_cplugin.url is defined and sonar_cplugin.url | length > 0 | ||
|
||
- name: "{{ sonar_cplugin.name }} | Set current plugins's default download URL no custom one" | ||
set_fact: | ||
cplugin_url: "{{ sonar_cplugin.commercial | ternary(sonar_commercial_plugin_baseurl,sonar_plugin_baseurl) }}/{{ sonar_cplugin.name }}/{{ cplugin_fname }}" | ||
when: cplugin_url is not defined or cplugin_url | length <= 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
- name: "set plugin json url" | ||
set_fact: | ||
plugin_url: "{{ __sonar_marketplace_url }}/{{ sonar_cplugin.name }}.json" | ||
|
||
- name: "get plugin json for {{ sonar_cplugin.name }}" | ||
uri: | ||
url: "{{ plugin_url }}" | ||
method: GET | ||
return_content: yes | ||
status_code: 200 | ||
body_format: json | ||
register: result | ||
|
||
- name: "extract plugin info" | ||
set_fact: | ||
plugin_info: "{{ result['content'] | from_json }}" | ||
|
||
- name: "check version" | ||
assert: | ||
that: | ||
- "'versions' in plugin_info" | ||
- "sonar_cplugin.version in plugin_info['versions']|map(attribute='version')|list" | ||
msg: "{{ sonar_cplugin.name }} plugin version '{{ sonar_cplugin.version }}' doesn't exist in {{ plugin_url }}" | ||
|
||
- name: "set download url" | ||
set_fact: | ||
cplugin_url: "{{ (plugin_info['versions']|selectattr('version','equalto',sonar_cplugin.version))[0]['downloadURL'] }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters