Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore(scripts): fix stable release promote script#13204

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

mafredri
Copy link
Member

This fixes the promote command to use the right payload...

Switches from GH_ to GITHUB_TOKEN as well and adds gh_auth for completeness.

@mafredrimafredri self-assigned thisMay 7, 2024
@mafredrimafredriforce-pushed themafredri/chore-scripts-fix-release-promote-env branch from4bd38cd to40651ddCompareMay 7, 2024 19:02
@mafredrimafredriforce-pushed themafredri/chore-scripts-fix-release-promote-env branch from40651dd tocb9f2d1CompareMay 7, 2024 19:05
Copy link
Collaborator

@stirbystirby left a comment

Choose a reason for hiding this comment

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

Glad to see you found the issue. Nice!

Just giving my ack here, should await devs' review.

@@ -4,6 +4,9 @@ set -euo pipefail
# shellcheck source=scripts/lib.sh
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"

# Make sure GITHUB_TOKEN is set for the release command.
Copy link
Member

Choose a reason for hiding this comment

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

This only works whenCODER=true i.e. inside a Coder workspaces.

Copy link
Member

Choose a reason for hiding this comment

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

Do we suggest adding an extra "echo" to indicate it?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

That’s the expected use-case. And if it isn’t set outside a workspace it’ll print a notice to dogh auth login. Just realized that won’t work though, but we could updatelib.sh to fetch the token viagh auth token in this case.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Perhaps we also shouldn't override GITHUB_TOKEN if it's set? And maybe support GH_TOKEN too (in lib.sh)? Thoughts@matifali?

Copy link
Member

Choose a reason for hiding this comment

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

Yes as far it works and make it more robust. Let's do this. I don't fully understand the difference betweenGH_ andGITHUB_ prefix for tokens.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I thinkGH_ is legacy, sometimes still used.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I refactored it a bit@matifali, if it still looks alright to you, I'll go ahead and merge:9417866

@@ -4,6 +4,9 @@ set -euo pipefail
# shellcheck source=scripts/lib.sh
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"

# Make sure GITHUB_TOKEN is set for the release command.
Copy link
Member

Choose a reason for hiding this comment

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

Do we suggest adding an extra "echo" to indicate it?

@@ -144,6 +144,8 @@ gh_auth() {
GITHUB_TOKEN=$(coder external-auth access-token github)
export GITHUB_TOKEN
fi
elif token="$(gh auth token --hostname github.com2>/dev/null)";then
export GITHUB_TOKEN=$token
Copy link
Member

Choose a reason for hiding this comment

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

👍🏼

Comment on lines +137 to +138
if [[ -z ${GITHUB_TOKEN:-} ]]; then
if [[ -n ${GH_TOKEN:-} ]]; then
Copy link
Member

Choose a reason for hiding this comment

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

We should always get the new token. The token stored inGITHUB_TOKEN may be stale, so I opted to refresh this even though it's set.

coder external-auth access-token github handles the auto-refreshing automatically.

Copy link
Member

@matifalimatifali left a comment
edited
Loading

Choose a reason for hiding this comment

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

When inside a coder workspace, We should always get the new token. The token stored inGITHUB_TOKEN may be stale, so I opted to refresh this even though it's set.

@mafredri
Copy link
MemberAuthor

mafredri commentedMay 8, 2024
edited
Loading

When inside a coder workspace, We should always get the new token. The token stored inGITHUB_TOKEN may be stale, so I opted to refresh this even though it's set.

@matifali Why would there be a token stored inGITHUB_TOKEN that's stale, and how would that happen? The reason I made external auth secondary to the env being set is that during yesterdays release we ran into the issue of the Coder external-auth token (i.e. GitHub App) not having all the required permissions, so we had to manuallygh auth login and use that token.

matifali and stirby reacted with thumbs up emoji

@matifali
Copy link
Member

If someone sets the token manually or inject viacoder_env that would stale for sure. But as we have full control over the dogfood template and there is no way theGITHUB_TOKEN can be automatically set so I think it's fine to merge. I am perhaps over thinking.

@matifalimatifali self-requested a reviewMay 8, 2024 15:37
@mafredri
Copy link
MemberAuthor

If someone sets the token manually or inject viacoder_env that would stale for sure. But as we have full control over the dogfood template and there is no way theGITHUB_TOKEN can be automatically set so I think it's fine to merge. I am perhaps over thinking.

@matifali I'm happy you are over-thinking, wouldn't want to break any use-cases. I think the best solution would be to probe the validity of the token, and if it's expired run the path within the if-statement. I think we can leave that for future enhancement, though.

matifali reacted with heart emoji

@github-actionsgithub-actionsbot added the staleThis issue is like stale bread. labelMay 16, 2024
@stirby
Copy link
Collaborator

@mafredri, if this resolves all the script issues we encountered, can should merge soon? Colin and I ran through the scripts for patching mainline and would like to do the same for stable tomorrow.

@github-actionsgithub-actionsbot removed the staleThis issue is like stale bread. labelMay 17, 2024
@mafredrimafredrienabled auto-merge (squash)May 17, 2024 08:20
@mafredrimafredri merged commitf66d044 intomainMay 17, 2024
28 checks passed
@mafredrimafredri deleted the mafredri/chore-scripts-fix-release-promote-env branchMay 17, 2024 08:25
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsMay 17, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@dannykoppingdannykoppingdannykopping approved these changes

@matifalimatifalimatifali approved these changes

@mtojekmtojekmtojek approved these changes

@stirbystirbystirby approved these changes

Assignees

@mafredrimafredri

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@mafredri@matifali@stirby@dannykopping@mtojek

[8]ページ先頭

©2009-2025 Movatter.jp