https://github.com/jonashackt/gitlab-ci-shell-example
Example project using GitLab CI shell executor
https://github.com/jonashackt/gitlab-ci-shell-example
Last synced: about 1 year ago
JSON representation
Example project using GitLab CI shell executor
- Host: GitHub
- URL: https://github.com/jonashackt/gitlab-ci-shell-example
- Owner: jonashackt
- License: mit
- Created: 2019-08-26T11:59:39.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-08-26T17:26:10.000Z (almost 2 years ago)
- Last Synced: 2025-02-28T13:47:33.822Z (over 1 year ago)
- Language: Java
- Size: 24.4 KB
- Stars: 11
- Watchers: 3
- Forks: 10
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Example app for building inside GitLab CI - using shell executor
=============================
This GitLab CI example needs a corresponding GitLab runner configuration - see https://github.com/jonashackt/gitlab-ci-stack#configure-gitlab-runner-with-shell-executor
See [.gitlab-ci.yml](.gitlab-ci.yml):
```
# One of the new trends in Continuous Integration/Deployment is to:
# (see https://docs.gitlab.com/ee/ci/docker/using_docker_build.html)
#
# 1. Create an application image
# 2. Run tests against the created image
# 3. Push image to a remote registry
# 4. Deploy to a server from the pushed image
stages:
- build
- test
- push
- deploy
# see usage of Namespaces at https://docs.gitlab.com/ee/user/group/#namespaces
variables:
REGISTRY_GROUP_PROJECT: $CI_REGISTRY/root/gitlab-ci-shell-example
# see how to login at https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#using-the-gitlab-container-registry
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY
build-image:
stage: build
# the tag 'shell' advices only GitLab runners using this tag to pick up that job
tags:
- shell
script:
- docker build . --tag $REGISTRY_GROUP_PROJECT/gitlab-ci-shell-example:latest
test-image:
stage: test
tags:
- shell
script:
- echo Insert fancy API test here!
push-image:
stage: push
tags:
- shell
script:
- docker push $REGISTRY_GROUP_PROJECT/gitlab-ci-shell-example:latest
deploy-2-dev:
stage: deploy
tags:
- shell
script:
- echo You should use Ansible here!
environment:
name: dev
url: https://dev.jonashackt.io
```
### Swagger REST-API-Documentation
Start the app and go to [http://localhost:8080/v2/api-docs](http://localhost:8080/v2/api-docs) to see all endpoints as JSON.
UI-Documentation you will find under [http://localhost:8080/swagger-ui.html](http://localhost:8080/swagger-ui.html).