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

test: Use automatically created GITHUB_TOKEN for smoketest #524

Merged
merged 1 commit into from
Aug 1, 2024

Conversation

rockdaboot
Copy link
Contributor

This hopefully fixes the error from gh in the smoketest:

Program: ./get_username.sh
Error Message: gh: Resource not accessible by integration (HTTP 403)

@rockdaboot rockdaboot self-assigned this Jul 31, 2024
@github-actions github-actions bot added the aws-λ-extension AWS Lambda Extension label Jul 31, 2024
@kruskall kruskall requested a review from a team July 31, 2024 14:32
@@ -20,7 +20,7 @@ jobs:
test:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Copy link
Member

@reakaleek reakaleek Jul 31, 2024

Choose a reason for hiding this comment

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

I'm afraid this is just another syntax to get the same token.

We would need to grant the token the correct permissions.

However, unfortunately, I don't see appropriate permissions to query the GH user API.

Copy link
Member

@reakaleek reakaleek Jul 31, 2024

Choose a reason for hiding this comment

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

As an alternative, we could use a machine user token.

or

I don't know the context and what the username is used for, but could we do something like:

if [[ -n "$CI"]]; then 
  user_name = "github-actions"
else 
# ...
fi

in https://github.com/elastic/apm-aws-lambda/blob/54ff53aaaefba7d67d93a71bbca14631749df3d5/testing/smoketest/get_username.sh#L11-L10 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good suggestion. Using a hard-coded user_name in CI should be fine.

The gh tool doesn't has permissions in CI and a using a hard-coded
user_name is sufficient.
@rockdaboot rockdaboot force-pushed the smoketest-use-github-token branch from 57e9562 to 40f6c6b Compare July 31, 2024 16:17
@rockdaboot rockdaboot merged commit dc6cda6 into elastic:main Aug 1, 2024
10 checks passed
@rockdaboot rockdaboot deleted the smoketest-use-github-token branch August 1, 2024 06:04
@rockdaboot
Copy link
Contributor Author

@reakaleek Sorry, I messed this up. Fix at #525

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws-λ-extension AWS Lambda Extension
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants