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

Replace the rest of the hardcoded references to amd64 with {{ go_arch }} #23

Merged
merged 1 commit into from
Jul 29, 2020

Conversation

mkeesey
Copy link
Contributor

@mkeesey mkeesey commented Jul 26, 2020

Thank you for writing this role - it saved me a bunch of time writing my own.

I've updated the install tasks to use {{ go_arch}} instead of amd64 directly. This should match how the binaries are downloaded - I followed the pattern used in #22.

I have a pi and an old debian-running macbook I ran this updated version against and it appears to successfully install and run promtail on both of the hosts.

This should match how the binaries are downloaded.
Copy link
Owner

@patrickjahns patrickjahns left a comment

Choose a reason for hiding this comment

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

Would it make sense to remove {{ go_arch }} from the binary itself ?

@@ -54,23 +54,23 @@

- name: Check promtail binary
stat:
path: "{{ promtail_install_dir }}/{{ promtail_version }}/promtail-linux-amd64"
path: "{{ promtail_install_dir }}/{{ promtail_version }}/promtail-linux-{{ go_arch }}"
Copy link
Owner

Choose a reason for hiding this comment

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

would it make sense to shorten the path to

Suggested change
path: "{{ promtail_install_dir }}/{{ promtail_version }}/promtail-linux-{{ go_arch }}"
path: "{{ promtail_install_dir }}/{{ promtail_version }}/promtail"

dest: "{{ promtail_install_dir }}/{{ promtail_version }}"
creates: "{{ promtail_install_dir }}/{{ promtail_version }}/promtail-linux-amd64"
creates: "{{ promtail_install_dir }}/{{ promtail_version }}/promtail-linux-{{ go_arch }}"
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
creates: "{{ promtail_install_dir }}/{{ promtail_version }}/promtail-linux-{{ go_arch }}"
creates: "{{ promtail_install_dir }}/{{ promtail_version }}/promtail"

@@ -79,7 +79,7 @@
ignore_errors: "{{ ansible_check_mode }}"
file:
state: link
src: "{{ promtail_install_dir }}/{{ promtail_version }}/promtail-linux-amd64"
src: "{{ promtail_install_dir }}/{{ promtail_version }}/promtail-linux-{{ go_arch }}"
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
src: "{{ promtail_install_dir }}/{{ promtail_version }}/promtail-linux-{{ go_arch }}"
src: "{{ promtail_install_dir }}/{{ promtail_version }}/promtail"

@patrickjahns
Copy link
Owner

@mkeesey
Thank you very much for the PR and please excuse the delay in review.
The change itself makes sense - I am wondering if it would make sense to completely remove the notion of architecture from the binary itself? What do you think/suggest?

Let me know and I merge the PR and create a new release :-)

@mkeesey
Copy link
Contributor Author

mkeesey commented Jul 29, 2020

@mkeesey
Thank you very much for the PR and please excuse the delay in review.
The change itself makes sense - I am wondering if it would make sense to completely remove the notion of architecture from the binary itself? What do you think/suggest?

Let me know and I merge the PR and create a new release :-)

No problem at all! Thanks for taking a look.

I think a lot of the necessity of the architecture-specific name comes down to the unzip process - the Grafana folks package the binary within the zip itself with OS and architecture specific names. Annoyingly, I haven't found a reasonable way to transform the filenames within the zip as they are extracted from promtail-$OS-$arch to a standard name like promtail. We could do a copy or move step afterwards so that the existence check at the beginning and the symlinking stage can use the base name, but it seems simpler to me to stay with the convention the upstream packagers use so we don't have to worry about multiple stages of checking if we need to do an operation.

I'm definitely ok with playing around with it some more if you want to iterate on the design a bit. 👍

@patrickjahns
Copy link
Owner

Thanks for your explanation 👍

but it seems simpler to me to stay with the convention the upstream packagers use so we don't have to worry about multiple stages of checking if we need to do an operation.

Agreed - I'll merge the PR and create a new release. Thank you very much for your efforts

@patrickjahns patrickjahns added bug Something isn't working semver:minor Change leading to a minor level version bump labels Jul 29, 2020
@patrickjahns patrickjahns merged commit 1535ba2 into patrickjahns:master Jul 29, 2020
@github-actions github-actions bot mentioned this pull request Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working semver:minor Change leading to a minor level version bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants