You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enhance description of working with private packages (#237)
* Add info on unregistered private package
Also clarifies the multiple uses of SSH keys.
* fix
* more fix
* yet more fix
* and more
* try
* more indent
* sigh
* temp
* again
* more
* more fmt
* Add info about the private key
---------
Co-authored-by: Dae Woo Kim <[email protected]>
Note: Around September 1, 2021, GitHub has added new security requirements for newly added RSA keys. Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.
41
-
<!-- Note: It might have error when you install package from Holylab repository after you finished all steps, the error is "ERROR: failed to fetch from [email protected]". If you face this problem, it might be helpful to replace the command above by -->
- When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.
48
-
```
49
-
Enter a file in which to save the key (/home/you/.ssh/id_ecdsa): [Press enter]
50
-
```
33
+
Most interactions with GitHub require authentication, which is handled by SSH. There are at least two distinct cases:
51
34
52
-
- At the prompt, type a secure passphrase if you want.
53
-
```
54
-
Enter passphrase (empty for no passphrase): [Type a passphrase]
55
-
Enter same passphrase again: [Type passphrase again]
56
-
```
35
+
-`github_push_key`: when you want to `push` code from a local machine up to GitHub: for this case, your private key remains only on your local machine and your public key needs to be registered with your GitHub account.
36
+
-`github_CI_key`: when you want a package you're developing and hosting on GitHub to be able to access private repositories (e.g., during CI): for this case, the private key gets pasted into a repository secret, and the public key needs to be registered with your GitHub account.
57
37
58
-
1.2 Adding your SSH key to the ssh-agent
59
-
- Start the ssh-agent in the background.
60
-
```
61
-
$ eval "$(ssh-agent -s)"
62
-
Agent pid 59566
63
-
```
38
+
If both of these uses apply to you, you should generate two separate keys for the two cases.
64
39
65
-
- Add your SSH private key to the ssh-agent
66
-
```
67
-
$ ssh-add ~/.ssh/id_ecdsa
68
-
```
69
-
2. Setup SSH Authentication for Git Bash on Windows (Safe to skip for Linux)
40
+
Here are the steps needed to generate a key:
70
41
71
-
2.1 Configure SSH for Git Hosting Server
72
-
- Add the following text to .ssh/config (.ssh should be found in the root of your user home folder):
73
-
```
74
-
Host github.com<br>
75
-
Hostname github.com<br>
76
-
IdentityFile ~/.ssh/id_ecdsa
77
-
```
78
-
79
-
2.2 Enable SSH Agent Startup Whenever Git Bash is Started
80
-
- First, ensure that following lines are added to .bash_profile, which should be found in your root user home folder:
81
-
```
82
-
test -f ~/.profile && . ~/.profile
83
-
test -f ~/.bashrc && . ~/.bashrc
84
-
```
85
-
- Now, add the following text to .bashrc, which should be found in your root user home folder:
86
-
```
87
-
# Start SSH Agent
88
-
#----------------------------
42
+
1.1 Generating a new SSH key at a local machine.
89
43
90
-
SSH_ENV="$HOME/.ssh/environment"
44
+
- Open git bash and paste text below, substituting in your GitHub email address.
Note: Around September 1, 2021, GitHub has added new security requirements for newly added RSA keys. Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.
91
49
92
-
function run_ssh_env {
93
-
. "${SSH_ENV}" > /dev/null
94
-
}
50
+
- When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.
51
+
```
52
+
Enter a file in which to save the key (/home/you/.ssh/id_ecdsa): [Press enter]
53
+
```
54
+
It's recommended to name the key something informative, e.g., `github_push_key` or `github_CI_key` for the two cases described at the top of this section.
95
55
96
-
function start_ssh_agent {
97
-
echo "Initializing new SSH agent..."
98
-
ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
99
-
echo "succeeded"
100
-
chmod 600 "${SSH_ENV}"
56
+
- At the prompt, type a secure passphrase if you want. (Do not use a passphrase for `github_CI_key` cases, just hit <Enter> at the prompts below.)
57
+
```
58
+
Enter passphrase (empty for no passphrase): [Type a passphrase]
59
+
Enter same passphrase again: [Type passphrase again]
60
+
```
101
61
102
-
run_ssh_env;
62
+
1.2 Adding your SSH key to the ssh-agent (only for `github_push_key`)
If you plan to host your new package on `HolyLab`, instead use
172
-
173
-
```julia
174
-
julia> t =Template(user="HolyLab", ...)
175
-
```
179
+
If you instead want to host your package within your personal GitHub account, omit `user="HolyLab"` from the above `Template` call (or specify your own user name).
3bd9afcd-55df-531a-9b34-dc642dce7b95 = { name = "RFFT", path = "RFFT" }
244
248
```
245
249
246
-
## Accessing the HolyLabRegistry in a CI workflow
250
+
## Accessing HolyLabRegistry or private packages in CI tests
247
251
248
-
This is required only if your package uses other packages which are registered in this HolyLabRegistry registry.
252
+
This is required only if your package uses other packages which are registered in this HolyLabRegistry registry,
253
+
or your package depends on unregistered private packages.
254
+
255
+
- In the repository's `Settings`, go to `Secrets and Variables` and expand the caret, click on `Actions`. Add a `New repository secret` called `SSH_PRIVATE_KEY`, and copy the contents of the *private* key for your `github_CI_key` (i.e., not the file ending in `.pub`)
249
256
250
257
- Set a secret key in the repository settings if you want to use private dependent packages in our lab.
251
258
The key should not include a passphrase when the key pair is generated. Add the public key as a 'new SSH key'
@@ -263,8 +270,8 @@ jobs:
263
270
strategy:
264
271
# setting ...
265
272
steps:
266
-
- uses: actions/checkout@v3
267
-
- name: Setup SSH Keys and known_hosts # This section is required if the dependent packages include private packages in our lab.
273
+
- uses: actions/checkout@v3
274
+
- name: Setup SSH Keys and known_hosts # This section is required if the dependent packages include private packages in our Lab.
268
275
env:
269
276
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
270
277
run: |
@@ -287,7 +294,25 @@ jobs:
287
294
- uses: julia-actions/julia-runtest@v1
288
295
```
289
296
290
-
## Tagging a new release
297
+
If you're instead wanting to manually add unregistered dependencies, then you should have something like this:
298
+
299
+
```
300
+
- name: Build package manually # manual because of dependency on MyPrivatePackage
These lines replace `julia-actions/julia-buildpkg@v1`, so do not use this action if you're doing things this way.
314
+
315
+
## Registering a new release in HolyLabRegistry
291
316
292
317
### In the package directory
293
318
@@ -325,3 +350,9 @@ Use the sha from the `git cat-file` command above.
325
350
# See also
326
351
327
352
- Creating a registry : https://discourse.julialang.org/t/creating-a-registry/12094
353
+
354
+
# Tips for Julia 0.7 and 1.0
355
+
356
+
In case of very old code, here are some tips:
357
+
358
+
- `pkg> registry add` does not work. For earlier Julia versions, manually `git clone` this repository under `DEPOT_PATH/registries`. (Usually, `DEPOT_PATH = /home/username/.julia`)
0 commit comments