Commit d4abbd83 authored by Maximilian Dolling's avatar Maximilian Dolling

Resolve "generate general framework"

parent a4b0f57d
stages:
- build-deploy-dev
- build-deploy
variables:
VERSION: 0.0.1
DOCKER_DST_IMAGE_NAME: ci-services
DOCKER_FILE: docker/Dockerfile
build-dev-image:
stage: build-deploy-dev
image: docker:19.03.1
tags:
- ci-services
before_script:
- echo "$CI_BUILD_TOKEN" | docker login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"
script:
- docker build --pull -t "${CI_REGISTRY_IMAGE}/$DOCKER_DST_IMAGE_NAME:latest-dev" -f $DOCKER_FILE ${DOCKER_BUILD_PATH:-.}
- docker push "${CI_REGISTRY_IMAGE}/$DOCKER_DST_IMAGE_NAME:latest-dev"
except:
- master
build-ci-service-image:
stage: build-deploy
image: docker:19.03.1
tags:
- ci-services
before_script:
- echo "$CI_BUILD_TOKEN" | docker login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"
script:
- docker build --pull -t "${CI_REGISTRY_IMAGE}/$DOCKER_DST_IMAGE_NAME:$VERSION" -f $DOCKER_FILE ${DOCKER_BUILD_PATH:-.}
- docker push "${CI_REGISTRY_IMAGE}/$DOCKER_DST_IMAGE_NAME:$VERSION"
- docker build --pull -t "${CI_REGISTRY_IMAGE}/$DOCKER_DST_IMAGE_NAME:latest" -f $DOCKER_FILE ${DOCKER_BUILD_PATH:-.}
- docker push "${CI_REGISTRY_IMAGE}/$DOCKER_DST_IMAGE_NAME:latest"
only:
- master
Maximilian Dolling, maximilian.dolling@gfz-potsdam.de
\ No newline at end of file
# CI-Services
This Framework provides various services for the GitLab CI regarding to software quality.
The services are packed into a docker image.
You can run the image locally or by setting up a GitLab CI/CD pipeline.
Planned Features:
## Currently implemented services
* **test**: runs no actual service, just gives information if everything seems fine
## Running the services
### via GitLab CI/CD
#### requirements
* repo hosted on [GFZ external Gitlab](gitext.gfz-potsdam.de)
### locally
#### requirements
* [docker](https://www.docker.com/)
```bash
docker login gitext.gfz-potsdam.de:5000
docker pull gitext.gfz-potsdam.de:5000/hifis/software-services/fair/ci-services/ci-services:latest
docker run -v [/absolute/path/to/repo]:/repo \
gitext.gfz-potsdam.de:5000/hifis/software-services/fair/ci-services/ci-services:latest \
[SERVICE]]
```
## Further planned features
* license check
* license header check
* comment check
......@@ -12,4 +32,5 @@ Planned Features:
* credential check
* DOI request
* curate meta data
* generate report
\ No newline at end of file
* generate report
* test for code hosting
FROM ubuntu:18.04
LABEL maintainer="Maximilian Dolling <mdolling@gfz-potsdam.de>"
# copy entrypoint script to executables
COPY ./docker/docker-entrypoint.sh /usr/local/bin/
COPY ./docker/entrypoint-manual.txt /usr/local/bin/
# copy service scripts to root dir
COPY ./services /services
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["--help"]
#!/usr/bin/env bash
# checks if a repository was bound to the docker image
if [[ ! -d /repo ]]
then
echo
echo "Repository to run services on not bound! Showing help page..."
cat /usr/local/bin/entrypoint-manual.txt
exit 1
fi
# checks for command line argument to start respective service
if [ "$1" = "--help" ] || [ "$1" = "-h" ]
then
cat /usr/local/bin/entrypoint-manual.txt
exit 0
fi
if [ "$1" = "--test" ] || [ "$1" = "-t" ]
then
/services/test/service_test.sh
exit 0
fi
# if no suitable argument was found, shows help page
echo
echo "Unknown command line argument! Showing help page..."
cat /usr/local/bin/entrypoint-manual.txt
exit 1
Usage: docker run -v [PATH/TO/REPO]:/repo [SERVICE]
Runs various services for software quality detection.
Needs a directory to run services on bound to '/repo'
Available services:
-h, --help shows this help page
-t, --test show the content of the repo to run services on
and list all available services
#!/usr/bin/env bash
echo
echo "Content of the repo to run services on:"
ls -lisa /repo
echo
echo "Available services within this version of the image"
ls --format single-column /services
echo
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment