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

--hide-prev-plan-comments doesn't work if Github App name contains a period #2695

Closed
krrrr38 opened this issue Nov 19, 2022 · 4 comments · Fixed by #2697
Closed

--hide-prev-plan-comments doesn't work if Github App name contains a period #2695

krrrr38 opened this issue Nov 19, 2022 · 4 comments · Fixed by #2697
Labels
bug Something isn't working

Comments

@krrrr38
Copy link
Contributor

krrrr38 commented Nov 19, 2022

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Overview of the Issue

When create GitHub app which contains ., --hide-prev-plan-comments option never works fine.

Becasue GitHub uses app name as atlantis.app and identifier is atlantis-app like a following.

image

Reproduction Steps

  1. create GitHub app which contains . e.g. atlantis.app
  2. setup GitHub app credential
  3. restart atlantis with following configurations
  • --gh-app-slug=atlantis-app
  • --hide-prev-plan-comments

then hide-prev-plan-comments not works, because github pr comment uses atlantis-app[bot] not atlantis.app[bot].

image

If we use --gh-app-slug=atlantis.app, we got following error.

Error: initializing server: getting user: getting app details: GET https://api.github.com/apps/atlantis.app: 404 Not Found []

Environment details

  • Atlantis version: v0.20.1
  • Atlantis flags:

Atlantis server-side config file:

ATLANTIS_HIDE_PREV_PLAN_COMMENTS=true
ATLANTIS_ATLANTIS_URL=${ATLANTIS_URL}
ATLANTIS_REPO_CONFIG=/opt/atlantis/repos.yaml
ATLANTIS_REPO_ALLOWLIST=${REPOSITORY}
ATLANTIS_WRITE_GIT_CREDS=true
ATLANTIS_GH_APP_ID=263516
ATLANTIS_GH_APP_SLUG="atlantis-app"
ATLANTIS_GH_APP_KEY_FILE=${GH_APP_KEY_FILE}
ATLANTIS_GH_WEBHOOK_SECRET=${GH_WEBHOOK_SECRET}

Additional Context

There are 2 solutions. When create atlantis.app GitHub app,

  • 1: Use --gh-app-slug=atlantis.app and get app info from https://api.github.com/apps/atlantis-app not https://api.github.com/apps/atlantis.app in the following code.

app, _, err := ghClient.Apps.Get(ctx, c.AppSlug)

  • 2: Use --gh-app-slug=atlantis-app and convert username in the following code.

// Currently there is no way to get the bot's login info, so this is a
// hack until Github exposes that.
return fmt.Sprintf("%s[bot]", app.GetName()), nil

@krrrr38 krrrr38 added the bug Something isn't working label Nov 19, 2022
@nitrocode
Copy link
Member

I believe this is a duplicate of #1161

@nitrocode nitrocode reopened this Nov 19, 2022
@nitrocode
Copy link
Member

If it's separate, please open a PR. We'd be happy to merge it. :)

@nitrocode nitrocode changed the title GitHub app name doesn't match when hide prev plan comment using comma included name --hide-prev-plan-comments doesn't work if Github App name contains a comma Nov 19, 2022
@nitrocode
Copy link
Member

Do you mean a comma , or a period . ? The github app name you show contains a period.

@krrrr38
Copy link
Contributor Author

krrrr38 commented Nov 19, 2022

Thank you for sharing the nearest issue and editing the description. You are right.

I think #2697 may solve these issues.

@krrrr38 krrrr38 changed the title --hide-prev-plan-comments doesn't work if Github App name contains a comma --hide-prev-plan-comments doesn't work if Github App name contains a period Nov 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants