-
Notifications
You must be signed in to change notification settings - Fork 29
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
Make changes to allow for mac users #81
Conversation
Mac setup
Add sed back in for image tagging, cleanup globals
@@ -25,12 +25,12 @@ | |||
|
|||
# Setup tag if current container image build is successful | |||
- name: Modify tags on images | |||
shell: "{{ oc_bin }} get imagestream | awk '{print $2}' | grep -v DOCKER | sed 's/.*5000\\///g' | grep '{{ build_config_name_files[template_name] }}' | xargs -i {{ oc_bin }} tag {}:latest {}:{{ tag }}" | |||
shell: "{{ oc_bin }} get imagestream | awk '{print $2}' | grep -v DOCKER | sed 's/.*5000\\///g' | grep '{{ build_config_name_files[template_name] }}' | xargs -I{} {{ oc_bin }} tag {}:latest {}:{{ tag }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to change this to -I vs -i?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh whoops, i meant to leave a comment on this. -i
is deprecated and -I
is the preferred option. Also, -i
does not exist for the bsd xargs command.
http://man7.org/linux/man-pages/man1/xargs.1.html
-i[replace-str], --replace[=replace-str]
This option is a synonym for -Ireplace-str if replace-str is
specified. If the replace-str argument is missing, the effect
is the same as -I{}. This option is deprecated; use -I
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this address all instances of xargs -i?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went through and changed all of them from -i
to -I{}
, as according to the man page they have the effect
@@ -40,15 +40,15 @@ | |||
ignore_errors: yes | |||
|
|||
- name: "Cleanup all failed dc, bc, routes, svc, and imagestreams on the cluster" | |||
shell: "{{ oc_bin }} get all | grep '{{ failed_container_name }}' | awk '{print $1}' | egrep -v 'builds\\/|po\\/' | xargs -i {{ oc_bin }} delete {}" | |||
shell: "{{ oc_bin }} get all | grep '{{ failed_container_name }}' | awk '{print $1}' | egrep -v 'builds\\/|po\\/' | xargs -I{} {{ oc_bin }} delete {}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to change this to -I vs -i?
with_items: "{{ oc_check_app_status.stdout_lines }}" | ||
loop_control: | ||
loop_var: failed_container_name | ||
ignore_errors: yes | ||
when: oc_check_app_status.stdout != "" | ||
|
||
- name: "Cleanup any serviceaccounts, pvc, and rolebindings for an app if it exists on the cluster" | ||
shell: "{{ oc_bin }} get {{ item }} | egrep '{{ oc_check_app_status.stdout_lines|join('|') }}' | awk '{print $1}' | xargs -i {{ oc_bin }} delete {{ item }}/{}" | ||
shell: "{{ oc_bin }} get {{ item }} | egrep '{{ oc_check_app_status.stdout_lines|join('|') }}' | awk '{print $1}' | xargs -I{} {{ oc_bin }} delete {{ item }}/{}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to change this to -I vs -i?
when: modify_tags|bool == true and current_build_succeeded|bool == true | ||
|
||
# Output the OpenShift build logs if the current build failed | ||
- name: Output the OpenShift build logs if the current build failed | ||
shell: "echo \"{{ oc_build_result.stdout }}\" | awk '{print $1}' | xargs -i {{ oc_bin }} logs builds/{}" | ||
shell: "echo \"{{ oc_build_result.stdout }}\" | awk '{print $1}' | xargs -I{} {{ oc_bin }} logs builds/{}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to change this to -I vs -i?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice Job LGTM
**Best attempt at some of the logic, it doesn't feel great so if you have a better way something could be done, i will gladly make the change