Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for GitLab CI/CD. #24

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .gitlab-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
stages: # List of stages for jobs, and their order of execution
- setup
- package
- release

variables:
GITHUB_BRANCH_NAME: ${CI_COMMIT_BRANCH} # Redefining the variables that are replicated-cli specifics
GITHUB_TAG_NAME: ${CI_COMMIT_TAG} # Redefining the variables that are replicated-cli specifics

'Verify Variables': # Added this stage just to verify that all variables are set as expected
stage: setup
script:
- "echo Release branch name: ${GITHUB_BRANCH_NAME}"
- "echo Release tag name: ${GITHUB_TAG_NAME}"
- "echo Replicated Application: ${REPLICATED_APP}" # This variable is set as a Project CI/CID Variable to not expose the value in the source code
- "echo Replicated API Token ${REPLICATED_API_TOKEN}" # This variable is set as a Project CI/CID Variable to not expose the value in the source code
vsklevko marked this conversation as resolved.
Show resolved Hide resolved

'Package with Helm': # Package with Helm
stage: package
image:
name: alpine/helm:latest
entrypoint: [""] # This is a must. Entrypoint must be overriden to allow the script part to work. Script can not be skipped for the pipeline spec.
script:
- helm package -u . -d manifests/ # As the entrypoint is skipped, specifying the entire command.
artifacts:
paths:
- "**/*.tgz"

'Create a release on Channel': # Making a Release
stage: release
dependencies:
- 'Package with Helm'
image:
name: replicated/vendor-cli:latest
entrypoint: [""] # This is a must. Entrypoint must be overriden to allow the script part to work. Script can not be skipped for the pipeline spec.
script:
- /replicated release create --auto -y # As the entrypoint is skipped, specifying the entire command.

'Release Kubernetes Installer': # Making Kurl Installer Release
stage: release
image:
name: replicated/vendor-cli:latest
entrypoint: [""]
script:
- /replicated installer create --auto -y
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,24 @@ In this case you have a few options:
1. Remove all helm manifests from this repo, and configure a pipeline to manually new chart versions as `.tgz` archives into `manifests/` and then use `replicated release create` from there.


## Integrating with CI
## Integrating with GitHub

This repo contains a [GitHub Actions](https://help.github.com/en/github/automating-your-workflow-with-github-actions/about-github-actions) workflow for ci at [./.github/workflows/main.yml](./.github/workflows/main.yml). You'll need to [configure secrets](https://help.github.com/en/github/automating-your-workflow-with-github-actions/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables) for `REPLICATED_APP` and `REPLICATED_API_TOKEN`. On every push this will:

- Ensure a channel exists for the branch that was pushed to
- Create a release based on the contents of `./manifests`

### Integration with GitLab

This repo contains GitLab CI configuration [.gitlab-ci.yaml](./gitlab-ci.yml). The configuration requires a `REPLICATED_APP` and `REPLICATED_API_TOKEN` variables set outside of the configuration using [GitLab CI/CD Variables](https://docs.gitlab.com/ee/ci/variables/#define-a-cicd-variable-in-the-ui)

The pipeline in the example configuration:

- Prints out variables. *This stem must be used only for debug purposes and removed for pdouction.*
- Packages Helm Chart
- Creates Replicated release
- Creates kURL installer release based on the [./kurl-installer.yaml](./kurl-installer.yaml) spec

## Advanced Usage

### Integrating kurl installer yaml
Expand Down