Skip to content

Commit d13c4b7

Browse files
committed
Adding docs for example project
1 parent badf3d0 commit d13c4b7

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,46 @@ https://docs.gitlab.com/ee/user/project/container_registry.html#build-and-push-i
450450
https://docs.gitlab.com/ee/user/group/#namespaces
451451

452452

453+
## Import example project with .gitlab-ci.yml and run Gitlab CI pipeline
454+
455+
Now we´re nearly there. Just add a new password for the root user and login with that credentials. Then head over to to `Create a project` and there click on `Import Project` / `Repo by URL`:
456+
457+
![import-project](import-project.png)
458+
459+
Paste the example Projects git URL into __Git repository URL__ field: `https://github.com/jonashackt/restexamples.git`, change Visibility Level to __Internal__ and hit __Create Project__.
460+
461+
Now at __CI / CD__ / __Pipelines__ fire up the Pipeline once (only this time manually since we didn´t push something new) and it should build a simple Spring Boot example project and push the resulting Image into our branch new Gitlab Container Registry:
462+
463+
![successful-first-pipeline-run](successful-first-pipeline-run.png)
464+
465+
The example project [restexamples](https://github.com/jonashackt/restexamples) has a [prepared .gitlab-ci.yml already](https://github.com/jonashackt/restexamples/blob/master/.gitlab-ci.yml), so it should do everything smoothly:
466+
467+
```
468+
stages:
469+
- build
470+
471+
# see usage of Namespaces at https://docs.gitlab.com/ee/user/group/#namespaces
472+
variables:
473+
REGISTRY_GROUP_PROJECT: $CI_REGISTRY/root/restexamples
474+
475+
# see how to login at https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#using-the-gitlab-container-registry
476+
before_script:
477+
- docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY
478+
479+
build-and-push:
480+
stage: build
481+
script:
482+
- docker build . --tag $REGISTRY_GROUP_PROJECT/restexamples:latest
483+
- docker push $REGISTRY_GROUP_PROJECT/restexamples:latest
484+
```
485+
486+
And you should be able to see your newly pushed Image in the Gitlab Registry overview:
487+
488+
![gitlab-registry-overview](gitlab-registry-overview.png)
489+
490+
491+
492+
453493
# Links
454494

455495
* Gitlab CI REFERENCE docs: https://docs.gitlab.com/ce/ci/yaml/README.html

gitlab-registry-overview.png

310 KB
Loading

import-project.png

391 KB
Loading

successful-first-pipeline-run.png

245 KB
Loading

0 commit comments

Comments
 (0)