-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from sensu/js/add-gitlab-docs
Add GitLab Instruction doc
- Loading branch information
Showing
3 changed files
with
62 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,7 +108,7 @@ jobs: | |
- name: Checkout | ||
uses: actions/checkout@v2 | ||
# Step 2: use the versioned sensu/sensuflow action | ||
# Step 2: use the versioned sensu/sensu-flow action | ||
- name: Sensuflow with required settings | ||
uses: sensu/[email protected] | ||
with: | ||
|
@@ -260,9 +260,14 @@ _OR_ | |
description: Optional boolean argument to to disable sanity checks default: false | ||
|
||
|
||
## Adapting to Other CI/CD Workflows | ||
If you would like to adapt this for other CI/CD workflows, take a look at the sensuflow.sh script from this repositorory. The script should be self-documenting with regard to needed executable dependancies and information concerning environment variables used. | ||
## Using the Docker container image with other CI/CD tools | ||
While this is originally developed and tested for use with GitHub Actions, there is a vendor neutral `sensu/sensu-flow` [Docker](https://hub.docker.com/repository/docker/sensu/sensu-flow) container image available as of version `0.6.0` that should be suitable for use with any CI/CD tool chain that is capable of using container images for CI/CD jobs. Here's a list of contributed instructions for alternative CI/CD vendors: | ||
|
||
|
||
* [GitLab](docs/GITLAB.md) | ||
|
||
Contributed instructions for additional CI/CD services are welcome. | ||
|
||
## Goals | ||
|
||
SensuFlow is under active development, so please don't hesitate to submit issues for any enhancements you'd like to see. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
## GitLab | ||
You can use the `sensu/sensu-flow` [Docker container image](https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#define-image-in-the-gitlab-ciyml-file) with GitLab. This container image includes everything needed to run the `sensuflow.sh` script originally developed for GitHub actions. Please note, it's a good idea to use GitLab's support for [Vault Secrets](https://docs.gitlab.com/ee/ci/yaml/index.html#secrets) for sensitive authentication variables such as the Sensu api key or password. | ||
|
||
### Important environment variables | ||
When using the docker image with GitLab, you'll need to be aware of several environment variables used by the `sensuflow.sh` script run within the Docker container. These variables are documented in the `sensuflow.sh` header comments, but here's a quick summary for reference. | ||
|
||
``` | ||
## Required Environment Variables | ||
# SENSU_API_URL: sensu backend api url used by sensuctl | ||
# SENSU_API_KEY: sensu api key for sensuctl, used instead of user and password above | ||
## Optional Environment Variables | ||
# SENSU_CA: CA certificate as a string | ||
# SENSU_CA_FILE: CA certificate file, if set overrides SENSU_CA | ||
# CONFIGURE_OPTIONS: Additional sensuctl configure options | ||
# NAMESPACES_DIR: directory holding sensuflow namepace subdirectories | ||
# NAMESPACES_FILE: file holding namespace resource definitions sensuflow action should create | ||
# MANAGED_RESOURCES: comma seperated list of resources | ||
# MATCHING_LABEL: resource label to match | ||
# MATCHING_CONDITION: condition to match | ||
# DISABLE_SANITY_CHECKS: if set disable sanity checks | ||
# DISABLE_TLS_VERIFY: if set disable TLS verification | ||
## Deprecated Authentication Environment Variables | ||
# SENSU_USER: sensu user for sensuctl configue (deprecated, use SENSU_API_KEY) | ||
# SENSU_PASSWORD: sensu password for sensuctl configure (deprecated, use SENSU_API_KEY) | ||
``` | ||
|
||
### Reference GitLab CI/CD job definition | ||
Here's a reference example for a GitLab CI/CD job definition making use of the `sensu/sensu-flow` docker image together with an api-key seeded into a vault. | ||
``` | ||
stages: | ||
- deploy | ||
.sensu_flow: | ||
image: sensu/sensu-flow:latest | ||
variables: | ||
MATCHING_CONDITION: "== '$CI_PROJECT_NAME'" | ||
SENSU_BACKEND_URL: https://sensu-api.example.com | ||
secrets: | ||
SENSU_API_KEY: | ||
vault: sensu/sensu-flow/api-key | ||
file: false | ||
script: | ||
- /sensuflow.sh | ||
sensu_flow: | ||
extends: .sensu_flow | ||
stage: deploy | ||
variables: | ||
VERBOSE: "1" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters