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

[RUM-4060] Fix datadog-ci path resolving on iOS scripts #38

Merged
merged 2 commits into from
Jun 12, 2024

Conversation

marco-saia-datadog
Copy link
Member

@marco-saia-datadog marco-saia-datadog commented Jun 11, 2024

What does this PR do?

Introduces a better way to resolve the datadog-ci executable path, taking advantage of the node resolver.

Motivation

The iOS scripts added to the build phases by the Datadog Expo plugin depend on datadog-ci and they currently use a relative path, assuming that the cwd at execution time will always be the same, while it can actually vary depending on the setup.

Additional Notes

The core of the PR is:

if [[ -z "$DATADOG_CI_EXEC" ]]; then
    export DATADOG_CI_EXEC="$("$NODE_BINARY" --print "require('path').resolve(require('path').dirname(require.resolve('@datadog/datadog-ci/package.json')), '../../.bin/datadog-ci')")"
fi

This approach conforms to how Expo resolves paths, and it also allows to override DATADOG_CI_EXEC if ever needed.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)
  • If this PR is auto-generated, please make sure also to manually update the code related to the change

@marco-saia-datadog marco-saia-datadog force-pushed the marcosaia/RUM-4060/fix-datadog-ci-path branch from 79747da to 0e7558d Compare June 11, 2024 16:11
@marco-saia-datadog marco-saia-datadog force-pushed the marcosaia/RUM-4060/fix-datadog-ci-path branch from 0e7558d to effe4c2 Compare June 11, 2024 16:18
@marco-saia-datadog marco-saia-datadog marked this pull request as ready for review June 11, 2024 16:21
@marco-saia-datadog marco-saia-datadog requested a review from a team as a code owner June 11, 2024 16:21
0xnm
0xnm previously approved these changes Jun 12, 2024
Copy link
Member

@0xnm 0xnm left a comment

Choose a reason for hiding this comment

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

nice improvement!

@marco-saia-datadog marco-saia-datadog force-pushed the marcosaia/RUM-4060/fix-datadog-ci-path branch from 53810f4 to f19acf0 Compare June 12, 2024 13:51
@marco-saia-datadog marco-saia-datadog merged commit dc2ea2e into main Jun 12, 2024
5 checks passed
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.

Plugin causes build errors on iOS Adding expo-datadog breaks my build on expo 49
2 participants