Skip to content

Commit

Permalink
OPSEXP-3055 Refactor repository war downloads to use defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
pmacius committed Feb 21, 2025
1 parent f85089f commit cdd4ea6
Show file tree
Hide file tree
Showing 18 changed files with 90 additions and 36 deletions.
6 changes: 3 additions & 3 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
"filename": "playbooks/acs.yml",
"hashed_secret": "0ca8f28152882e5edb182fc3f7d4ae10a5b10dc5",
"is_verified": false,
"line_number": 500
"line_number": 509
}
],
"roles/activemq/molecule/default/tests/test_activemq.py": [
Expand Down Expand Up @@ -173,7 +173,7 @@
"filename": "roles/repository/tasks/main.yml",
"hashed_secret": "0eeb6b7bb932e8594b4ffe039dc15332f670cbd9",
"is_verified": false,
"line_number": 91,
"line_number": 111,
"is_secret": false
}
],
Expand Down Expand Up @@ -208,5 +208,5 @@
}
]
},
"generated_at": "2025-02-20T20:40:33Z"
"generated_at": "2025-02-21T15:31:21Z"
}
4 changes: 0 additions & 4 deletions 7.3.N-extra-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ amps:
googledrive_share:
repository: "{{ nexus_repository.releases }}/integrations/alfresco-googledrive-share"
version: 3.4.2
api_explorer:
artifact_name: api-explorer
repository: "{{ nexus_repository.releases }}"
version: 7.3.0
transform:
artifact_name: alfresco-transform-core-aio
repository: "{{ nexus_repository.releases }}"
Expand Down
4 changes: 0 additions & 4 deletions 7.4.N-extra-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ amps:
repository: >-
{{ nexus_repository.releases }}/integrations/alfresco-googledrive-share
version: 3.4.2
api_explorer:
artifact_name: api-explorer
repository: "{{ nexus_repository.releases }}"
version: 7.4.0
transform:
artifact_name: alfresco-transform-core-aio
repository: "{{ nexus_repository.releases }}"
Expand Down
4 changes: 0 additions & 4 deletions community-extra-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ acs:
repository: "{{ nexus_repository.releases }}"
version: 23.4.1
edition: Community
api_explorer:
artifact_name: api-explorer
repository: "{{ nexus_repository.releases }}"
version: 23.4.0
transform:
artifact_name: alfresco-transform-core-aio
repository: "{{ nexus_repository.releases }}"
Expand Down
2 changes: 1 addition & 1 deletion docs/deployment-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ Or:
```yaml
war_downloads:
- url: "https://your.repo.com/path/to/your/artifacts/your-api-explorer.war"
sha1_checksum_url: "https://your.repo.com/path/to/your/artifacts/your-api-explorer.war.sha1"
checksum: "sha1:https://your.repo.com/path/to/your/artifacts/your-api-explorer.war.sha1"
dest: "{{ content_folder }}/web-server/webapps/api-explorer.war"
```

Expand Down
10 changes: 0 additions & 10 deletions group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ amps:
repository: >-
{{ nexus_repository.releases }}/integrations/alfresco-googledrive-share
version: 4.1.0
api_explorer:
artifact_name: api-explorer
repository: "{{ nexus_repository.releases }}"
version: 23.4.0
transform:
artifact_name: alfresco-transform-core-aio
repository: "{{ nexus_repository.releases }}"
Expand All @@ -60,12 +56,6 @@ downloads:
{{ transform.repository }}/{{ transform.artifact_name }}/{{ transform.version }}/{{ transform.artifact_name }}-{{ transform.version }}.jar
transform_jar_sha1_checksum_url: >-
{{ transform.repository }}/{{ transform.artifact_name }}/{{ transform.version }}/{{ transform.artifact_name }}-{{ transform.version }}.jar.sha1
war_downloads:
- url: >-
{{ api_explorer.repository }}/{{ api_explorer.artifact_name }}/{{ api_explorer.version }}/{{ api_explorer.artifact_name }}-{{ api_explorer.version }}.war
dest: "{{ content_folder }}/web-server/webapps/api-explorer.war"
sha1_checksum_url: >-
{{ api_explorer.repository }}/{{ api_explorer.artifact_name }}/{{ api_explorer.version }}/{{ api_explorer.artifact_name }}-{{ api_explorer.version }}.war.sha1
amp_downloads:
- url: >-
{{ amps.googledrive_repo.repository }}/{{ amps.googledrive_repo.version }}/alfresco-googledrive-repo-enterprise-{{ amps.googledrive_repo.version }}.amp
Expand Down
11 changes: 10 additions & 1 deletion playbooks/acs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -285,14 +285,23 @@
raw_properties: "{{ properties_snippets }}"
repository_identity_url: "{{ identity_url | default('') }}"
tomcat_version: "{{ acs_play_tomcat_version }}"
repository_api_explorer_version: "{{ acs_play_repository_api_explorer_version }}"
repository_api_explorer_archive_url: "{{ acs_play_repository_api_explorer_archive_url }}"
repository_api_explorer_archive_checksum_url: "{{ acs_play_repository_api_explorer_archive_checksum_url }}"
repository_extra_war_downloads: "{{ acs_play_repository_extra_war_downloads }}"
repository_war_nexus_username: "{{ nexus_user }}"
repository_war_nexus_password: "{{ nexus_password }}"
post_tasks:
- name: Update installation status file with ACS
become: true
vars:
acs_components:
acs: "{{ acs }}"
amps: "{{ amps }}"
api_explorer: "{{ api_explorer }}"
api_explorer:
artifact_name: "{{ acs_play_repository_api_explorer_artifact_name }}"
repository: "{{ acs_play_repository_api_explorer_repository }}"
version: "{{ acs_play_repository_api_explorer_version }}"
ansible.builtin.blockinfile:
block: "{{ acs_components | to_nice_yaml(indent=2) }}"
create: true
Expand Down
9 changes: 9 additions & 0 deletions playbooks/group_vars/repository.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
acs_play_repository_api_explorer_artifact_name: api-explorer
acs_play_repository_api_explorer_repository: "{{ nexus_repository.releases }}"
acs_play_repository_api_explorer_archive_url: "{{ acs_play_repository_api_explorer_repository }}/{{ acs_play_repository_api_explorer_artifact_name }}/{{ acs_play_repository_api_explorer_version }}/{{ acs_play_repository_api_explorer_artifact_name }}-{{ acs_play_repository_api_explorer_version }}.war"
acs_play_repository_api_explorer_archive_checksum_url: "sha1:{{ acs_play_repository_api_explorer_archive_url }}.sha1"
# additional list of war downloads
acs_play_repository_extra_war_downloads: []
# - url: "https://your.repo.com/path/to/your/artifacts/your-war.war"
# checksum: "sha1:https://your.repo.com/path/to/your/artifacts/your-war.war.sha1"
# dest: "{{ content_folder }}/web-server/webapps/your-war.war"
2 changes: 1 addition & 1 deletion playbooks/prerun-upgrade-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
acs.edition != installed_components.acs.edition or
acs.version.split('.')[:3] | join('.') != installed_components.acs.version.split('.')[:3] | join('.') or
acs.version is version(installed_components.acs.version, 'lt') or
api_explorer.version != installed_components.api_explorer.version
acs_play_repository_api_explorer_version != installed_components.api_explorer.version
- name: Fail on unsupported AMPS upgrades
ansible.builtin.fail:
Expand Down
17 changes: 17 additions & 0 deletions roles/repository/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,23 @@ acs_environment:
- $JAVA_OPTS
JAVA_TOOL_OPTIONS:
- $JAVA_TOOL_OPTIONS
# war downloads
repository_api_explorer_artifact_name: api-explorer
repository_api_explorer_repository: https://artifacts.alfresco.com/nexus/content/groups/public/org/alfresco

repository_api_explorer_version: 23.4.0
repository_api_explorer_archive_url: "{{ repository_api_explorer_repository }}/{{ repository_api_explorer_artifact_name }}/{{ repository_api_explorer_version }}/{{ repository_api_explorer_artifact_name }}-{{ repository_api_explorer_version }}.war"
repository_api_explorer_archive_checksum_url: "sha1:{{ repository_api_explorer_archive_url }}.sha1"

repository_default_war_downloads:
- url: "{{ repository_api_explorer_archive_url }}"
checksum: "{{ repository_api_explorer_archive_checksum_url }}"
dest: "{{ content_folder }}/web-server/webapps/api-explorer.war"

repository_extra_war_downloads: []

repository_war_nexus_username: null
repository_war_nexus_password: null

# CSRF config
csrf:
Expand Down
31 changes: 31 additions & 0 deletions roles/repository/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,34 @@ argument_specs:
default: alfresco
description: |
The realm to be used when contacting the identity service
repository_api_explorer_version:
type: str
required: false
description: |
The version of the API Explorer to deploy
repository_api_explorer_archive_url:
type: str
required: false
description: |
The URL to download the API Explorer archive from
repository_api_explorer_archive_checksum_url:
type: str
required: false
description: |
The URL to download the checksum of the API Explorer archive from
repository_extra_war_downloads:
type: list
required: false
description: |
A list containing the URL and checksum of additional WAR files to download
repository_war_nexus_username:
type: str
required: false
description: |
The username to use when downloading WAR files from Nexus
repository_war_nexus_password:
type: str
required: false
no_log: true
description: |
The password to use when downloading WAR files from Nexus
2 changes: 2 additions & 0 deletions roles/repository/molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@
repository_properties: "{{ global_properties }}"
raw_properties:
- ../../configuration_files/alfresco-global.properties
repository_war_nexus_username: "{{ lookup('env', 'NEXUS_USERNAME') }}"
repository_war_nexus_password: "{{ lookup('env', 'NEXUS_USERNAME') }}"
8 changes: 4 additions & 4 deletions roles/repository/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@

- name: Download war files
become: true
loop: "{{ war_downloads }}"
loop: "{{ repository_default_war_downloads + repository_extra_war_downloads }}"
ansible.builtin.get_url:
url: "{{ item.url }}"
checksum: sha1:{{ lookup('url', item.sha1_checksum_url, username=nexus_user, password=nexus_password) }}
checksum: "{{ item.checksum }}"
dest: "{{ item.dest }}"
url_username: "{{ nexus_user }}"
url_password: "{{ nexus_password }}"
url_username: "{{ repository_war_nexus_username }}"
url_password: "{{ repository_war_nexus_password }}"
owner: "{{ username }}"
group: "{{ group_name }}"
mode: "0644"
Expand Down
4 changes: 2 additions & 2 deletions roles/search_enterprise/molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
ansible.builtin.include_role:
name: "sfs"
vars:
sfs_zip_username: "{{ lookup('env', 'NEXUS_USERNAME') }}"
sfs_zip_password: "{{ lookup('env', 'NEXUS_PASSWORD') }}"
sfs_zip_username: "{{ molecule_nexus_username }}"
sfs_zip_password: "{{ molecule_nexus_password }}"
- name: "Include transformers"
ansible.builtin.include_role:
name: "transformers"
Expand Down
9 changes: 7 additions & 2 deletions roles/sync/molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
- name: Converge
hosts: all
vars:
molecule_nexus_username: "{{ lookup('env', 'NEXUS_USERNAME') }}"
molecule_nexus_password: "{{ lookup('env', 'NEXUS_PASSWORD') }}"
roles:
- role: activemq
- role: nginx
Expand Down Expand Up @@ -31,12 +34,14 @@
name: repository
vars:
repository_properties: "{{ global_properties }}"
repository_war_nexus_username: "{{ molecule_nexus_username }}"
repository_war_nexus_password: "{{ molecule_nexus_password }}"
- name: Install Alfresco sync service
ansible.builtin.include_role:
name: sync
vars:
sync_zip_username: "{{ lookup('env', 'NEXUS_USERNAME') }}"
sync_zip_password: "{{ lookup('env', 'NEXUS_PASSWORD') }}"
sync_zip_username: "{{ molecule_nexus_username }}"
sync_zip_password: "{{ molecule_nexus_password }}"
sync_environment:
JAVA_OPTS:
- -Xms512m
Expand Down
1 change: 1 addition & 0 deletions vars/acs23.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ acs_play_trouter_version: 4.1.6
acs_play_transformers_libreoffice_version: 7.2.5.1
acs_play_transformers_pdf_version: 1.1
acs_play_transformers_imagemagick_version: 7.1.0-16-ci-11
acs_play_repository_api_explorer_version: 23.4.0
1 change: 1 addition & 0 deletions vars/acs73.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ acs_play_trouter_version: 4.1.6
acs_play_transformers_libreoffice_version: 7.2.5.1
acs_play_transformers_pdf_version: 1.1
acs_play_transformers_imagemagick_version: 7.1.0-16-ci-11
acs_play_repository_api_explorer_version: 7.3.0
1 change: 1 addition & 0 deletions vars/acs74.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ acs_play_trouter_version: 4.1.6
acs_play_transformers_libreoffice_version: 7.2.5.1
acs_play_transformers_pdf_version: 1.1
acs_play_transformers_imagemagick_version: 7.1.0-16-ci-11
acs_play_repository_api_explorer_version: 7.4.0

0 comments on commit cdd4ea6

Please sign in to comment.