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

Make changes to allow for mac users #81

Merged
merged 9 commits into from
Sep 5, 2018
Merged

Make changes to allow for mac users #81

merged 9 commits into from
Sep 5, 2018

Conversation

werne2j
Copy link
Contributor

@werne2j werne2j commented Sep 5, 2018

  • Add instructions for Mac users
  • Change scripts to allow for a variable OS (linux or mac)

**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

@werne2j werne2j changed the title Make changes to allow for mac setup Make changes to allow for mac users Sep 5, 2018
@@ -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 }}"
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Contributor Author

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 {}"
Copy link
Member

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 }}/{}"
Copy link
Member

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/{}"
Copy link
Member

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?

Copy link
Member

@arilivigni arilivigni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice Job LGTM

@arilivigni arilivigni merged commit ff9fc37 into CentOS-PaaS-SIG:master Sep 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants