@@ -58,8 +58,6 @@ Fork this project into your personal namespace and configure it (menu `Settings`
...
@@ -58,8 +58,6 @@ Fork this project into your personal namespace and configure it (menu `Settings`
Our GitLab instance comes with a shared Docker-based CI/CD *runner* (or executor).
Our GitLab instance comes with a shared Docker-based CI/CD *runner* (or executor).
Generate your [SSH key pair](https://docs.gitlab.com/ee/ci/ssh_keys/) to interact with your VM instance.
Generate your [SSH key pair](https://docs.gitlab.com/ee/ci/ssh_keys/) to interact with your VM instance.
(**[TO-DO]** :question: Do we also need to enable `Repository > Deploy keys` with the same public SSH key?)
Configure the CI/CD system as it follows (menu `Settings > CI/CD`):
Configure the CI/CD system as it follows (menu `Settings > CI/CD`):
- In `General pipelines`:
- In `General pipelines`:
* [ ] `Public pipelines`
* [ ] `Public pipelines`
...
@@ -89,7 +87,7 @@ stages:
...
@@ -89,7 +87,7 @@ stages:
# Do here anything common to all jobs' scripts
# Do here anything common to all jobs' scripts
before_script:
before_script:
- # install needed packages in this runner
- # install needed packages in this runner (Web servr, etc.)
- # configure the git client on this runner
- # configure the git client on this runner
- # set up SSH keys via ssh-agent
- # set up SSH keys via ssh-agent
- # launch the ssh-agent and feed it our key from var $SSH_PRIVATE_KEY
- # launch the ssh-agent and feed it our key from var $SSH_PRIVATE_KEY
...
@@ -99,6 +97,7 @@ before_script:
...
@@ -99,6 +97,7 @@ before_script:
unit_test1:
unit_test1:
stage: test
stage: test
script:
script:
- # clone our repo locally
- # check the app version number and exit != 0 if it's wrong
- # check the app version number and exit != 0 if it's wrong
deploy_prod:
deploy_prod:
...
@@ -114,6 +113,8 @@ deploy_prod:
...
@@ -114,6 +113,8 @@ deploy_prod:
```
```
The "deploy_prod" stage shall run only if we're pushing to the main branch.
The "deploy_prod" stage shall run only if we're pushing to the main branch.
:bulb: If you followed the [Ansible exercise](https://gitedu.hesge.ch/lsds/teaching/bachelor/cloud-and-deployment/lab-ansible), you're encouraged to integrate it into the deploy stage. Otherwise, a simple remote copy via `scp` or `rsync` suffices.
### Task #3: test operation ###
### Task #3: test operation ###
**Goal:** Test the pipeline by pushing a commit to the main branch.
**Goal:** Test the pipeline by pushing a commit to the main branch.