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

Reference paths relative to project root #1800

Merged
merged 24 commits into from
Feb 17, 2023
Merged

Reference paths relative to project root #1800

merged 24 commits into from
Feb 17, 2023

Conversation

spawnia
Copy link
Contributor

@spawnia spawnia commented Nov 7, 2022

Before this PR:

  • some scripts change the current working directory and use relative paths
  • different approaches are taken to know which directory a script is running in
  • paths are sometimes relative, sometimes absolute, sometimes traversing directories

After this PR:

  • scripts are always run and assumed to be run from project root
  • paths are always relative to the project root

This should resolve an issue I already tried to fix with #1798, where the contents of ./sentry were not copied
into the built container image,
thus enhance-image.sh did not apply.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Before this PR:
- some scripts change the current working directory and use relative paths
- different approaches are taken to know which directory a script is running in
- paths are sometimes relative, sometimes absolute, sometimes traversing directories

After this PR:
- scripts do neither change nor care much about the current working directory
- a unified approach determines the directory of the current script
- paths are always relative to the project root

This should resolve an issue I already tried to fix with #1798,
where the contents of `./sentry` were not copied
into the built container image,
thus `enhance-image.sh` did not apply.
Copy link
Collaborator

@aminvakil aminvakil left a comment

Choose a reason for hiding this comment

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

I haven't checked each change, but this seems like a good improvement to me, thanks!

@spawnia
Copy link
Contributor Author

spawnia commented Nov 8, 2022

Thanks for your consideration. I wanted to make sure this is a direction you would like to pursue before doing further work on this. Can you assist me with the failing test cases? I am having trouble figuring out what is going wrong in Testing cleanup without minimizing downtime.

Copy link
Collaborator

@aminvakil aminvakil left a comment

Choose a reason for hiding this comment

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

I tried reproducing your branch on a clean VM and this change fixed the issue.

_unit-test/error-handling-test.sh Outdated Show resolved Hide resolved
Co-authored-by: Amin Vakil <info@aminvakil.com>
.pre-commit-config.yaml Show resolved Hide resolved
install.sh Outdated Show resolved Hide resolved
@spawnia spawnia changed the title Reference paths relative to the current script or project root Reference paths relative to project root Nov 10, 2022
@emmatyping
Copy link
Contributor

/gcbrun

@emmatyping
Copy link
Contributor

Hm, not sure why Google Cloud build is failing, I'll look into it.

…erences

# Conflicts:
#	_unit-test/error-handling-test.sh
#	install/build-docker-images.sh
#	install/error-handling.sh
@spawnia
Copy link
Contributor Author

spawnia commented Nov 22, 2022

@ethanhs @hubertdeng123 I guess CI is only failing due to #1803 (comment)? Given everything else passes, can you merge regardless so this fix can move forward?

@emmatyping
Copy link
Contributor

I'll take another look at this in a little bit, and if it looks good merge things.

@github-actions
Copy link

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@spawnia
Copy link
Contributor Author

spawnia commented Dec 20, 2022

I still think this is relevant and necessary and hope to see it merged some time soon.

@spawnia
Copy link
Contributor Author

spawnia commented Jan 18, 2023

@ethanhs @hubertdeng123 I have now updated this branch with the latest changes from master 4 times already, please review and consider merging 🙏

Copy link
Member

@hubertdeng123 hubertdeng123 left a comment

Choose a reason for hiding this comment

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

Sorry for the late response @spawnia , did a re-review here. I'm pretty neutral on these changes here but seems generally fine

It also looks like the permissions of detect-platform.sh has been changed.

install/build-docker-images.sh Outdated Show resolved Hide resolved
@spawnia
Copy link
Contributor Author

spawnia commented Jan 19, 2023

It also looks like the permissions of detect-platform.sh has been changed.

Yup, this is intentional. The file is only able to be sourced from other scripts. Due to lack of a shebang and the nature of its contents, it would not be able to be executed by itself.

@hubertdeng123 hubertdeng123 merged commit ec4f416 into getsentry:master Feb 17, 2023
@spawnia
Copy link
Contributor Author

spawnia commented Feb 17, 2023

Thank you @hubertdeng123

@hubertdeng123
Copy link
Member

Sorry for the long delay here @spawnia, thanks for submitting this PR 😁

@github-actions github-actions bot locked and limited conversation to collaborators Mar 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants