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

Nexus 3.8 will have a new URL for Rest API calls #43

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
3 changes: 3 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
nexus_download_url: "http://download.sonatype.com/nexus/3/"
nexus_version: '3.3.1-01'
nexus_package: "nexus-{{ nexus_version }}-unix.tar.gz"
nexus_download_dir: '/tmp'
Expand Down Expand Up @@ -27,6 +28,8 @@ nexus_docker_hosted_port: 9080
nexus_docker_proxy_port: 9081
nexus_docker_group_port: 9082
nexus_default_context_path: '/'
nexus_api_url: 'service/siesta/rest/v1/script/'
nexus_new_api_url: 'service/rest/v1/script/'

nexus_admin_password: 'changeme' # Note : admin password change subsequent to first-time install is *not implemented* yet
nexus_anonymous_access: false
Expand Down
2 changes: 1 addition & 1 deletion tasks/call_script.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: Calling Groovy script {{ script_name }}
uri:
url: "http://localhost:{{ nexus_default_port }}{{ nexus_default_context_path }}service/siesta/rest/v1/script/{{ script_name }}/run"
url: "http://localhost:{{ nexus_default_port }}{{ nexus_default_context_path }}{{ nexus_api_url }}{{ script_name }}/run"
user: 'admin'
password: "{{ current_nexus_admin_password }}"
headers:
Expand Down
6 changes: 3 additions & 3 deletions tasks/declare_script_each.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
---
- name: Removing (potential) previously declared Groovy script {{ item }}
uri:
url: "http://localhost:{{ nexus_default_port }}{{ nexus_default_context_path }}service/siesta/rest/v1/script/{{ item }}"
url: "http://localhost:{{ nexus_default_port }}{{ nexus_default_context_path }}{{ nexus_api_url }}{{ item }}"
user: 'admin'
password: "{{ current_nexus_admin_password }}"
method: DELETE
force_basic_auth: yes
status_code: 204,404
status_code: 200,204,404

- name: Declaring Groovy script {{ item }}
uri:
url: "http://localhost:{{ nexus_default_port }}{{ nexus_default_context_path }}service/siesta/rest/v1/script"
url: "http://localhost:{{ nexus_default_port }}{{ nexus_default_context_path }}{{ nexus_api_url }}"
user: 'admin'
password: "{{ current_nexus_admin_password }}"
body_format: json
Expand Down
11 changes: 11 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
---
- name: Determine minor version of Nexus
set_fact:
minor_nexus_version: "{{ nexus_version | regex_search(regexp,'\\1') }}"
vars:
regexp: '3\.(\d+)\..*'

- name: Set API URL
set_fact:
nexus_api_url: "{{ nexus_new_api_url }}"
when: minor_nexus_version >= 8

- include: nexus_purge.yml
when: ((purge is defined) and (purge | bool))

Expand Down