Skip to content

Commit

Permalink
Avoid setting username and token for git push (#780)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrodm authored Jul 30, 2024
1 parent 8e68ec8 commit 817e736
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ export GO_VERSION
# https://buildkite.com/docs/pipelines/managing-log-output#redacted-environment-variables

if [[ "$BUILDKITE_PIPELINE_SLUG" == "package-spec-test-with-integrations" && "$BUILDKITE_STEP_KEY" == "pr-integrations" ]]; then
# required to set the git commit information
GITHUB_USERNAME_SECRET="elasticmachine"
export GITHUB_USERNAME_SECRET=$GITHUB_USERNAME_SECRET
export GITHUB_EMAIL_SECRET="[email protected]"
# required by `gh` commands
export GITHUB_TOKEN=$VAULT_GITHUB_TOKEN
fi
10 changes: 4 additions & 6 deletions .buildkite/scripts/test-with-integrations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,10 @@ set_git_config() {
git config user.email "${GITHUB_EMAIL_SECRET}"
}

git_push_with_auth() {
local owner="$1"
local repository="$2"
local branch="$3"
git_push() {
local branch="$1"

retry 3 git push https://${GITHUB_TOKEN}@github.com/${owner}/${repository}.git "${branch}"
retry 3 git push origin "${branch}"
}

clone_repository() {
Expand Down Expand Up @@ -156,7 +154,7 @@ create_or_update_pull_request() {
update_dependency

echo "--- Pushing branch ${INTEGRATIONS_PR_BRANCH} to integrations repository..."
git_push_with_auth "${INTEGRATIONS_GITHUB_OWNER}" "${INTEGRATIONS_GITHUB_REPO_NAME}" "${INTEGRATIONS_PR_BRANCH}"
git_push "${INTEGRATIONS_PR_BRANCH}"

if [ -z "${integrations_pr_number}" ]; then
echo "--- Creating pull request :github:"
Expand Down

0 comments on commit 817e736

Please sign in to comment.