Skip to content

chore: update gh token #412

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

Merged
merged 1 commit into from
Nov 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions codebuild/release/upload_artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ env:
BRANCH: "master"
git-credential-helper: yes
secrets-manager:
GH_TOKEN: Github/aws-crypto-tools-ci-bot:personal\ access\ token\ (new\ token\ format)
GH_TOKEN: Github/aws-crypto-tools-ci-bot:ESDK Release Token

phases:
pre_build:
commands:
# get new project version
- export VERSION=$(grep version pom.xml | head -n 1 | sed -n 's/[ \t]*<version>\(.*\)<\/version>/\1/p')
- git config --global user.name "aws-crypto-tools-ci-bot"
- git config --global user.email "[email protected]"
- echo $GH_TOKEN > token.txt
- export GH_TOKEN=
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- export GH_TOKEN=
- export -n GH_TOKEN

The above assumes that terminal CodeBuild provides us is bash. If it is zsh, my suggestion will fail.
But it is not: https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec.shell
And both sh and bash support the -n flag on export.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ooh i like that better it is much cleaner. i'll test this and get back to you if we still have the same result

Copy link
Contributor Author

Choose a reason for hiding this comment

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

big oof! unfortunately the export -n option returns with export: Illegal option -n

Copy link
Contributor

Choose a reason for hiding this comment

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

For the record, CodeBuild does not support -n on export. We could probably use unset, but testing this is manual and time consuming, so I am approving this as is.

# install gh cli in order to upload artifacts
- curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg
- echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null
Expand All @@ -24,7 +28,8 @@ phases:
build:
commands:
- gh version
- gh auth login --with-token < $GH_TOKEN
- gh auth login --with-token < token.txt
- gh auth status
- |
mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.2:get \
-DrepoUrl=https://aws.oss.sonatype.org \
Expand Down