8 changed files with 108 additions and 0 deletions
@ -1,3 +1,4 @@ |
|||||
*.retry |
*.retry |
||||
inventory |
inventory |
||||
3scale-inventory.* |
3scale-inventory.* |
||||
|
bin |
||||
|
|||||
@ -0,0 +1,22 @@ |
|||||
|
--- |
||||
|
|
||||
|
- name: Check if go-swagger is installed globally |
||||
|
command: swagger version |
||||
|
register: check_global_goswagger_version |
||||
|
changed_when: false |
||||
|
ignore_errors: yes |
||||
|
|
||||
|
- set_fact: |
||||
|
threescale_cicd_goswagger_command: 'swagger' |
||||
|
when: check_global_goswagger_version is success |
||||
|
|
||||
|
- name: Check if go-swagger is installed locally |
||||
|
command: '{{ threescale_cicd_local_bin_path }}/swagger version' |
||||
|
register: check_local_goswagger_version |
||||
|
changed_when: false |
||||
|
ignore_errors: yes |
||||
|
when: check_global_goswagger_version is failed |
||||
|
|
||||
|
- set_fact: |
||||
|
threescale_cicd_goswagger_command: '{{ threescale_cicd_local_bin_path }}/swagger' |
||||
|
when: check_local_goswagger_version is success and check_local_goswagger_version is not skipped |
||||
@ -0,0 +1,36 @@ |
|||||
|
--- |
||||
|
|
||||
|
- name: Find the OS and architecture of the control node |
||||
|
setup: |
||||
|
gather_subset: '!all' |
||||
|
|
||||
|
- name: Find the latest version of go-swagger |
||||
|
uri: |
||||
|
url: https://api.github.com/repos/go-swagger/go-swagger/releases/latest |
||||
|
register: latest_goswagger_version |
||||
|
|
||||
|
- debug: |
||||
|
msg: 'Found go-swagger remotely, version {{ latest_goswagger_version.json.tag_name }}' |
||||
|
|
||||
|
- name: Create the folder to download go-swagger |
||||
|
file: |
||||
|
path: '{{ threescale_cicd_local_bin_path }}' |
||||
|
state: directory |
||||
|
|
||||
|
- name: Download go-swagger |
||||
|
get_url: |
||||
|
url: '{{ goswagger_download_url }}' |
||||
|
dest: '{{ threescale_cicd_local_bin_path }}/swagger' |
||||
|
mode: 0755 |
||||
|
vars: |
||||
|
goswagger_download_url: '{{ goswagger_asset.browser_download_url }}' |
||||
|
goswagger_asset: '{{ goswagger_assets|selectattr(''name'', ''equalto'', artifact_name)|first }}' |
||||
|
goswagger_assets: '{{ latest_goswagger_version.json.assets }}' |
||||
|
artifact_name: 'swagger_{{ ansible_system|lower }}_{{ swagger_architecture }}' |
||||
|
swagger_architecture: '{{ swagger_architecture_mapping[ansible_architecture] }}' |
||||
|
swagger_architecture_mapping: |
||||
|
x86_64: amd64 |
||||
|
armv7l: arm |
||||
|
|
||||
|
- set_fact: |
||||
|
threescale_cicd_goswagger_command: '{{ threescale_cicd_local_bin_path }}/swagger' |
||||
@ -0,0 +1,17 @@ |
|||||
|
--- |
||||
|
|
||||
|
- debug: |
||||
|
msg: > |
||||
|
Will use go-swagger at '{{ threescale_cicd_goswagger_command }}' as instructed. |
||||
|
Auto-detection and download is DISABLED. |
||||
|
when: threescale_cicd_goswagger_command is defined |
||||
|
|
||||
|
- include_tasks: "steps/find_goswagger.yml" |
||||
|
when: threescale_cicd_goswagger_command is not defined |
||||
|
|
||||
|
- include_tasks: "steps/install_goswagger.yml" |
||||
|
when: threescale_cicd_goswagger_command is not defined |
||||
|
|
||||
|
- name: Validate the provided OpenAPI Specification file |
||||
|
command: '{{ threescale_cicd_goswagger_command }} validate {{ threescale_cicd_openapi_file }}' |
||||
|
changed_when: false |
||||
Loading…
Reference in new issue