diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..3295e0c --- /dev/null +++ b/.gitlab-ci.yml @@ -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 + +'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 diff --git a/README.md b/README.md index 040ff40..9afde60 100644 --- a/README.md +++ b/README.md @@ -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