Using Gitlab Pipelines¤
Gitlab CI/CD allows for the automation and execution of workflows based on pushes, merge requests and other trigger events to your git repository. In order to control eccenca Corporate Memory instances from within Gitlab CI/CD based workflows you need to provide cmemc and the credentials for your instance to the Gitlab CI/CD pipeline.
In order to use cmemc in Gitlab pipelines you can use the cmemc docker image.
Adding the above to your pipeline description will provide a cmemc command which can be used in the workflow step.
Credentials and Usage¤
Since we should never commit credentials in your repository, we need to provide them as an encrypted secret managed outside of the repository. You can add CI/CD variables to a project’s settings directly in Gitlab.
Given the following pipeline step, you need to add
MY_OAUTH_CLIENT_SECRET as encrypted secrets to your repository:
test: image: name: docker-registry.eccenca.com/eccenca-cmemc:latest entrypoint: [""] stage: test script: - cmemc --version - cmemc graph import graph.ttl $GRAPH - cmemc graph count $GRAPH - cmemc graph delete $GRAPH variables: GRAPH: "https://github.com/seebi/cmemc-workflow" CMEM_BASE_URI: $MY_CMEM_BASE_URI OAUTH_GRANT_TYPE: $MY_OAUTH_GRANT_TYPE OAUTH_CLIENT_ID: $MY_OAUTH_CLIENT_ID AUTH_CLIENT_SECRET: $MY_OAUTH_CLIENT_SECRET
The above snippet also demonstrates how you can map your project variables to cmemc’s configuration variables.
The Github project eccenca/cmemc-workflow provides an example gitlab pipeline description which uses cmemc to import a graph, count the triples and removes the graph afterwards. Here is an example output: