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

Improve composer authentications password default #1412

Merged
merged 3 commits into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions group_vars/all/helpers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,4 @@ ssl_stapling_enabled: "{{ item.value.ssl is defined and item.value.ssl.stapling_
cron_enabled: "{{ site_env.disable_wp_cron and (not item.value.multisite.enabled | default(false) or (item.value.multisite.enabled | default(false) and item.value.multisite.cron | default(true))) }}"
sites_use_ssl: "{{ wordpress_sites.values() | map(attribute='ssl') | selectattr('enabled') | list | count > 0 }}"

# For backward compatibility, to be removed in Trellis v2.
site_packagist_org_authentications:
- { hostname: repo.packagist.com, username: token, password: "{{ vault_wordpress_sites[site].packagist_token | default('') }}" }
site_composer_authentications: "{{ vault_wordpress_sites[site].composer_authentications | default([]) }}"
composer_authentications: "{{ site_packagist_org_authentications + site_composer_authentications }}"
composer_authentications: "{{ vault_wordpress_sites[site].composer_authentications | default([]) }}"
3 changes: 1 addition & 2 deletions roles/deploy/hooks/build-after.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
- name: Setup composer authentications
composer:
command: config
arguments: --auth http-basic.{{ composer_authentication.hostname }} {{ composer_authentication.username }} {{ composer_authentication.password }}
arguments: --auth http-basic.{{ composer_authentication.hostname | quote }} {{ composer_authentication.username | quote }} {{ composer_authentication.password | default("") | quote }}
working_dir: "{{ deploy_helper.new_release_path }}"
no_log: true
changed_when: false
when:
- composer_authentication.hostname is defined and composer_authentication.hostname != ""
- composer_authentication.username is defined and composer_authentication.username != ""
- composer_authentication.password is defined and composer_authentication.password != ""
loop: "{{ composer_authentications | default([]) }}"
loop_control:
loop_var: composer_authentication
Expand Down
7 changes: 3 additions & 4 deletions roles/wordpress-install/tasks/composer-authentications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
- name: "Setup composer authentications - {{ site }}"
composer:
command: config
arguments: --auth http-basic.{{ composer_authentication.hostname }} {{ composer_authentication.username }} {{ composer_authentication.password }}
arguments: --auth http-basic.{{ composer_authentication.hostname | quote }} {{ composer_authentication.username | quote }} {{ composer_authentication.password | default("") | quote }}
working_dir: "{{ working_dir }}"
no_log: true
changed_when: false
when:
- not (not composer_authentication.hostname)
- not (not composer_authentication.username)
- not (not composer_authentication.password)
- composer_authentication.hostname is defined and composer_authentication.hostname != ""
- composer_authentication.username is defined and composer_authentication.username != ""
loop: "{{ composer_authentications | default([]) }}"
loop_control:
loop_var: composer_authentication
Expand Down