Skip to content

Commit

Permalink
[refactor] Off with git_current_branch variable
Browse files Browse the repository at this point in the history
Use instead
- `awx_playbook_branch` for `awx-instance` role,
- `images_build_branch` for `wordpress-openshift-namespace` role.
  • Loading branch information
Dominique Quatravaux committed Nov 6, 2021
1 parent 48835cc commit 9bb62ca
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 16 deletions.
7 changes: 1 addition & 6 deletions ansible/roles/awx-instance/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,8 @@
prj.organization = org
prj.scm_type = "git"
prj.scm_url = "{{ awx_project_github_url }}"
prj.scm_branch = "{{ _awx_playbook_branch }}"
prj.scm_branch = "{{ awx_playbook_branch }}"
prj.scm_update_on_launch = True
vars:
_awx_playbook_branch: >-
{{ awx_playbook_branch | default(
"master" if awx_is_production else git_current_branch)
}}
- import_tasks: container-group.yml
tags: awx
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
---
# defaults file for wordpress-openshift-namespace
# defaults file for wordpress-openshift-namespace role
images_build_branch: master
4 changes: 1 addition & 3 deletions ansible/roles/wordpress-openshift-namespace/tasks/images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
git:
repository: "{{ wp_ops_git_uri }}"
path: "{{ item.git_path }}"
ref: "{{ git_current_branch }}"
ref: "{{ images_build_branch }}"
strategy: "{{ item.strategy | default({}) }}"
with_items:
- name: "{{ wp_base_image_name }}"
Expand All @@ -42,9 +42,7 @@
--s3-bucket-name={{ build.s3_assets.bucket_name }}
--s3-key-id={{ build.s3_assets.key_id }}
--s3-secret={{ build.s3_assets.secret | eyaml(eyaml_keys) }}
{%if images_build_branch is defined %}
--manifest-url=https://raw.githubusercontent.com/epfl-si/wp-ops/{{ images_build_branch }}/ansible/roles/wordpress-instance/tasks/plugins.yml
{%endif%}
- name: "{{ httpd_image_name }}"
git_path: docker/httpd
from: "{{ wp_base_image_name }}"
Expand Down
6 changes: 0 additions & 6 deletions ansible/wpsible
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ cd "$(dirname "$0")"; cd "$(/bin/pwd)"
playbook_flags="-e play_update=yes -e play_backup=yes -e play_create_or_restore=yes"
ansible_flags="-e @roles/wordpress-instance/vars/main.yml"

git_current_branch="$(git rev-parse --abbrev-ref HEAD 2>/dev/null)"
case "$git_current_branch" in
"") : ;;
*) playbook_flags="$playbook_flags -e git_current_branch=$git_current_branch" ;;
esac

warn () {
if [ -n "$1" ]; then
echo "$@" >&2
Expand Down

0 comments on commit 9bb62ca

Please sign in to comment.