-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Update SPM and CI setup to fetch the private WordPress-rs repo #23424
Changes from all commits
bf9facd
d6ae5e2
b76d75f
67585cd
5271617
7867dfa
2e4d086
2f9db71
bc94d9f
52d7fa1
c370ed9
c895955
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash -eu | ||
|
||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then | ||
echo "This script must be sourced, not executed, because it exports GIT_SSH_COMMAND." | ||
exit 1 | ||
fi | ||
|
||
echo "--- :git: Change Git SSH key to fetch private dependencies" | ||
|
||
PRIVATE_REPO_FETCH_KEY_NAME="private_repos_key" | ||
# $PRIVATE_REPOS_BOT_KEY is declared in the `env` file of this pipeline in `mobile-secrets` | ||
add_ssh_key_to_agent "$PRIVATE_REPOS_BOT_KEY" "$PRIVATE_REPO_FETCH_KEY_NAME" | ||
jkmassel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is tidied up version of what Pocket Casts iOS does, too. See Automattic/a8c-ci-toolkit-buildkite-plugin#102 to track the possibility of DRYing at the CI plugin level. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,9 @@ let package = Package( | |
.package(url: "https://github.com/wordpress-mobile/WordPressUI-iOS", branch: "kean-patch-1"), | ||
.package(url: "https://github.com/wordpress-mobile/wpxmlrpc", from: "0.10.0"), | ||
.package(url: "https://github.com/zendesk/support_sdk_ios", from: "8.0.3"), | ||
.package(url: "https://github.com/Automattic/wordpress-rs", from: "0.1.0"), | ||
// This is currently a private repo. | ||
// Fetching it via SSH to avoid HTTPS auth prompts in CI. | ||
.package(url: "[email protected]:Automattic/wordpress-rs", from: "0.1.0"), | ||
], | ||
targets: XcodeSupport.targets + [ | ||
.target(name: "JetpackStatsWidgetsCore"), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ import WordPressAPI | |
import AutomatticTracks | ||
|
||
actor LoginClient { | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SwiftLint picked this and the ones below in CI, so I addressed them because I like the look of a green build 🤓 |
||
struct ApiDetails { | ||
let rootUrl: ParsedUrl | ||
let loginUrl: String? | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm not mistaken, technically speaking this doesn't change the SSH key (as in: replacing it) but adds it to the agent? (Meaning SSH will still try other keys in the agent if the first one(s) it tries fails?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It changes
GIT_SSH_COMMAND
so I think it's an accurate commentThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, right 👍
I think I conflated the use of
-i
alone (which would add the identity but, if used alone, still letssh
try other identities registered in the agent or the config file) with when-i
is used in association with-o IdentitiesOnly=yes
(like here) to ask thessh-agent
not to offer any keys, and only use the keys provided by-i
on the command line, or by the config files.To be even stricter we should also add
-F /dev/null
to also tell ssh not to use any keys configured in the config file either, to be sure that the only key it will proposed is the one provided via-i
and not try any other key boforehand; but in the case of CI and how Buildkite works wrt to exposing keys to SSH, I don't think any Identity would be configured in the~/.ssh/config
of our agents and risk being used and tried before the bot's private key provided here… so ultimately-F /dev/null
would probably unnecessary in this context.