Add public key from secret variable
This commit is contained in:
parent
a2a7be9357
commit
a04ef3f222
2 changed files with 3 additions and 3 deletions
|
@ -4,7 +4,6 @@ variables:
|
|||
REFERENCE_SOLUTION: $CI_PROJECT_NAMESPACE/solutions/solutions
|
||||
JPLAG_PATH: /app/jplag.jar
|
||||
CI_REPO_HOST: $CI_REGISTRY
|
||||
SSH_PUBLIC_KEY: deploy_key.pub
|
||||
|
||||
stages:
|
||||
- test
|
||||
|
@ -15,6 +14,7 @@ stages:
|
|||
|
||||
before_script:
|
||||
## get ssh private key from secret variable
|
||||
- echo "$SSH_PUBLIC_KEY" | tr -d '\r' > deploy_key.pub
|
||||
- eval $(ssh-agent -s)
|
||||
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
|
||||
- mkdir -p ~/.ssh
|
||||
|
@ -79,7 +79,7 @@ create_projects:
|
|||
- abgabesystem
|
||||
|
||||
script:
|
||||
- abgabesystem projects -c $CI_PROJECT_NAMESPACE -d $SSH_PUBLIC_KEY
|
||||
- abgabesystem projects -c $CI_PROJECT_NAMESPACE -d deploy_key.pub
|
||||
|
||||
only:
|
||||
- master
|
||||
|
|
|
@ -63,7 +63,7 @@ You can also [automate this](https://docs.gitlab.com/ce/ci/docker/using_docker_b
|
|||
|
||||
Proceed by creating an API token that has access to the group of the course.
|
||||
Add this token as `PRIVATE_API_TOKEN` to the [secret variables](https://docs.gitlab.com/ce/ci/variables/) of the forked abgabesystem project.
|
||||
Then generate an SSH deploy key and add the private part as `SSH_PRIVATE_KEY` to the secret variables.
|
||||
Then generate an SSH deploy key and add the private part as `SSH_PRIVATE_KEY` and the public key as `SSH_PUBLIC_KEY` to the secret variables.
|
||||
The key will be used by the CI script to fetch from the student projects.
|
||||
|
||||
Set up the the student projects using
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue