AtlasOfLivingAustralia / ala-install

Ansible playbooks for installing the ALA components
https://www.ala.org.au
Apache License 2.0
26 stars 52 forks source link

Undefined variable 'groupId' in tomcat_deploy #694

Closed vjrj closed 1 year ago

vjrj commented 1 year ago

We introduced a new issue with #690 , I think (or maybe we should update our inventories):

TASK [biocache3-service : download from maven repo https://nexus.ala.org.au/service/local/artifact/maven/redirect?r=public&g=au.org.ala&a=biocache-service&v=3.1.5&e=war&c=] ***
Thursday 05 October 2023  12:27:04 +0200 (0:00:00.505)       0:07:52.449 ****** 
fatal: [ala-install-test-1]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'groupId' is undefined\n\nThe error appears to be in '/data-additional/jenkins/ala-install-test/ala-install/ansible/roles/tomcat_deploy/tasks/main.yml': line 61, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: download from maven repo {{ war_url }}\n  ^ here\nWe could be wrong, but this one looks like it might be an issue with\nmissing quotes. Always quote template expression brackets when they\nstart a value. For instance:\n\n    with_items:\n      - {{ foo }}\n\nShould be written as:\n\n    with_items:\n      - \"{{ foo }}\"\n"}

cc @matthewandrews

matthewandrews commented 1 year ago

Aha, thanks, I must have missed that - basically any role using tomcat_deploy should have these variables set - this example from biocache-hub vars file:

version: "{{ biocache_hub_version | default('LATEST') }}"
artifactId: "{{ (biocache_hub_artifact | default(biocache_hub)) | default('generic-hub') }}"
groupId: "{{ biocache_hub_group_id | default('au.org.ala') }}"
classifier: "{{ biocache_hub_classifier | default('') }}"
packaging: "{{ biocache_hub_packaging | default('war') }}"
vjrj commented 1 year ago

These are the roles using tomcat_deploy with missing groupId:

$ for i in `grep -r tomcat_deploy ansible/roles | grep yml  | grep context | cut -d ":" -f 1 | uniq | cut -d "/" -f 1-3` ; do grep -L groupId $i/vars/*; done
ansible/roles/biocache-service/vars/main.yml
ansible/roles/solr4/vars/main.yml
ansible/roles/sandbox/vars/main.yml
ansible/roles/cas2/vars/main.yml
ansible/roles/biocache3-service/vars/main.yml
ansible/roles/geoserver/vars/main.yml
ansible/roles/geoserver/vars/main.yml
ansible/roles/ozatlas-proxy/vars/main.yml
ansible/roles/sightings/vars/main.yml

@matthewandrews, can we add a default ALA groupId to the tomcat_deploy task and only set it in geoserver?

PS: geoserver_war_url: "https://repo.osgeo.org/repository/release/org/geoserver/web/gs-web-app/2.19.2/gs-web-app-2.19.2.war"

vjrj commented 1 year ago

This still fails in the geoserver task:

TASK [download from maven repo https://repo.osgeo.org/repository/release/org/geoserver/web/gs-web-app/2.19.2/gs-web-app-2.19.2.war] ***
Wednesday 11 October 2023  10:58:11 +0200 (0:00:00.476)       0:04:45.725 ***** 
fatal: [ala-install-test-2]: FAILED! => {"changed": false, "msg": "group_id must be set"}

and

TASK [download from maven repo https://github.com/geonetwork/core-geonetwork/releases/download/3.4.4/geonetwork.war] ***
Wednesday 11 October 2023  12:02:54 +0200 (0:00:00.476)       0:11:12.970 ***** 
fatal: [ala-install-test-2]: FAILED! => {"changed": false, "msg": "group_id must be set"}
vjrj commented 1 year ago

I cannot fix the geonetwork war because:

We can:

matthewandrews commented 1 year ago

Oh - if geoserver is not using a maven repo, then I guess tomcat_deploy should have an option to use get_url rather than maven_artifact

vjrj commented 1 year ago

I've just added to #706 a variable for that:

image

image