Skip to content

Commit

Permalink
Extract steps to configure Git in CI and use in all builds
Browse files Browse the repository at this point in the history
  • Loading branch information
mokagio committed Jul 17, 2024
1 parent d6ae5e2 commit 53a9f33
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .buildkite/commands/build-for-testing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ if [[ "$APP" != "wordpress" && "$APP" != "jetpack" ]]; then
exit 1
fi

"$(dirname "${BASH_SOURCE[0]}")/configure-git-for-release-management.sh"

echo "--- :rubygems: Setting up Gems"
install_gems

Expand Down
2 changes: 2 additions & 0 deletions .buildkite/commands/prototype-build-jetpack.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash -eu

"$(dirname "${BASH_SOURCE[0]}")/configure-git-for-release-management.sh"

# Sentry CLI needs to be up-to-date
brew upgrade sentry-cli

Expand Down
11 changes: 1 addition & 10 deletions .buildkite/commands/prototype-build-wordpress.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
#!/bin/bash -eu

echo "--- :git: Change Git SSH key to fetch private dependencies"

PRIVATE_REPO_FETCH_KEY_NAME="private_repos_key"
add_ssh_key_to_agent "$PRIVATE_REPOS_BOT_KEY" "$PRIVATE_REPO_FETCH_KEY_NAME"
PRIVATE_REPO_FETCH_KEY="$HOME/.ssh/$PRIVATE_REPO_FETCH_KEY_NAME"

add_host_to_ssh_known_hosts 'github.com'

export GIT_SSH_COMMAND="ssh -i $PRIVATE_REPO_FETCH_KEY -o IdentitiesOnly=yes"
echo "Git SSH command is now $GIT_SSH_COMMAND"
"$(dirname "${BASH_SOURCE[0]}")/configure-git-for-release-management.sh"

# Sentry CLI needs to be up-to-date
brew upgrade sentry-cli
Expand Down
2 changes: 2 additions & 0 deletions .buildkite/commands/release-build-jetpack.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash -eu

"$(dirname "${BASH_SOURCE[0]}")/configure-git-for-release-management.sh"

brew install imagemagick
brew install ghostscript
# Sentry CLI needs to be up-to-date
Expand Down
2 changes: 2 additions & 0 deletions .buildkite/commands/release-build-wordpress.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash -eu

"$(dirname "${BASH_SOURCE[0]}")/configure-git-for-release-management.sh"

echo "--- :arrow_down: Installing Release Dependencies"
brew install imagemagick
brew install ghostscript
Expand Down
12 changes: 12 additions & 0 deletions .buildkite/commands/set-up-git-for-private-repos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash -eu

echo "--- :git: Change Git SSH key to fetch private dependencies"

PRIVATE_REPO_FETCH_KEY_NAME="private_repos_key"
add_ssh_key_to_agent "$PRIVATE_REPOS_BOT_KEY" "$PRIVATE_REPO_FETCH_KEY_NAME"
PRIVATE_REPO_FETCH_KEY="$HOME/.ssh/$PRIVATE_REPO_FETCH_KEY_NAME"

add_host_to_ssh_known_hosts 'github.com'

export GIT_SSH_COMMAND="ssh -i $PRIVATE_REPO_FETCH_KEY -o IdentitiesOnly=yes"
echo "Git SSH command is now $GIT_SSH_COMMAND"

0 comments on commit 53a9f33

Please sign in to comment.