-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: initial working version with job (#1)
- Loading branch information
1 parent
f73ec84
commit f9c5a33
Showing
18 changed files
with
343 additions
and
118 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
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
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 |
---|---|---|
@@ -1,39 +1,105 @@ | ||
# Orb Template | ||
# Gomplate Orb | ||
|
||
<!--- | ||
[![CircleCI Build Status](https://circleci.com/gh/<organization>/<project-name>.svg?style=shield "CircleCI Build Status")](https://circleci.com/gh/<organization>/<project-name>) [![CircleCI Orb Version](https://badges.circleci.com/orbs/<namespace>/<orb-name>.svg)](https://circleci.com/orbs/registry/orb/<namespace>/<orb-name>) [![GitHub License](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://raw.githubusercontent.com/<organization>/<project-name>/master/LICENSE) [![CircleCI Community](https://img.shields.io/badge/community-CircleCI%20Discuss-343434.svg)](https://discuss.circleci.com/c/ecosystem/orbs) | ||
[![CircleCI Build Status](https://circleci.com/gh/Xavientois/gomplate-orb.svg?style=shield "CircleCI Build Status")](https://circleci.com/gh/Xavientois/gomplate-orb) [![CircleCI Orb Version](https://badges.circleci.com/orbs/xavientois/gomplate.svg)](https://circleci.com/orbs/registry/orb/xavientois/gomplate) [![GitHub License](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://raw.githubusercontent.com/Xavientois/gomplate-orb/master/LICENSE) [![CircleCI Community](https://img.shields.io/badge/community-CircleCI%20Discuss-343434.svg)](https://discuss.circleci.com/c/ecosystem/orbs) | ||
|
||
---> | ||
_**An orb to render Go templates in CircleCI using Gomplate**_ | ||
|
||
A project template for Orbs. | ||
## Usage | ||
|
||
This repository is designed to be automatically ingested and modified by the CircleCI CLI's `orb init` command. | ||
In order to use this orb, just add it under the `orbs` section of your CircleCI `.circleci/config.yml`: | ||
|
||
_**Edit this area to include a custom title and description.**_ | ||
```yaml | ||
orbs: | ||
gomplate: xaventois/[email protected] | ||
``` | ||
## Examples | ||
### `render-template` command | ||
|
||
This command takes a template file and the input contexts/datasources and renders the template. | ||
|
||
```yaml | ||
version: 2.1 | ||
orbs: | ||
gomplate: xaventois/[email protected] | ||
jobs: | ||
render-greeting: | ||
executor: gomplate/gomplate | ||
steps: | ||
- run: | ||
name: "Generate greeting template and input values" | ||
command: | | ||
echo "Hello, {{ .values.name }}!" > greet.txt.tmpl | ||
echo "name: CircleCI" > values.yaml | ||
- gomplate/render-template: | ||
template-file: greet.txt.tmpl | ||
output-file: greet.txt | ||
contexts: values.yaml | ||
- run: | ||
name: "Output greeting" | ||
command: | | ||
cat test.txt | ||
workflows: | ||
greeting: | ||
jobs: | ||
- render-greeting | ||
``` | ||
|
||
### `render-config` job | ||
|
||
This job is designed to be used as part of a Dynamic Config setup workflow. It automatically calls the `continuation/continue` job upon rendering the template. | ||
|
||
```yaml | ||
version: 2.1 | ||
setup: true | ||
orbs: | ||
gomplate: xaventois/[email protected] | ||
workflows: | ||
use-my-orb: | ||
jobs: | ||
- gomplate/render-config: | ||
template-file: .circleci/continue_config.yml.tmpl | ||
output-file: .circleci/continue_config.yml | ||
pre-steps: | ||
- run: | ||
command: | | ||
echo '{ "a": "b", list: ["x", "y", "z"] }' > values.yaml | ||
contexts: values.yaml | ||
``` | ||
|
||
--- | ||
|
||
## Resources | ||
|
||
[CircleCI Orb Registry Page](https://circleci.com/orbs/registry/orb/<namespace>/<orb-name>) - The official registry page of this orb for all versions, executors, commands, and jobs described. | ||
[Documentation for this orb](https://circleci.com/orbs/registry/orb/xavientois/gomplate) - The official registry page of this orb for all versions, executors, commands, and jobs described. | ||
|
||
[CircleCI Orb Docs](https://circleci.com/docs/2.0/orb-intro/#section=configuration) - Docs for using, creating, and publishing CircleCI Orbs. | ||
|
||
### How to Contribute | ||
|
||
We welcome [issues](https://github.com/<organization>/<project-name>/issues) to and [pull requests](https://github.com/<organization>/<project-name>/pulls) against this repository! | ||
We welcome [issues](https://github.com/Xavientois/gomplate-orb/issues) to and [pull requests](https://github.com/Xavientois/gomplate-orb/pulls) against this repository! | ||
|
||
### How to Publish An Update | ||
1. Merge pull requests with desired changes to the main branch. | ||
- For the best experience, squash-and-merge and use [Conventional Commit Messages](https://conventionalcommits.org/). | ||
2. Find the current version of the orb. | ||
- You can run `circleci orb info <namespace>/<orb-name> | grep "Latest"` to see the current version. | ||
3. Create a [new Release](https://github.com/<organization>/<project-name>/releases/new) on GitHub. | ||
- You can run `circleci orb info xavientois/gomplate | grep "Latest"` to see the current version. | ||
3. Create a [new Release](https://github.com/Xavientois/gomplate-orb/releases/new) on GitHub. | ||
- Click "Choose a tag" and _create_ a new [semantically versioned](http://semver.org/) tag. (ex: v1.0.0) | ||
- We will have an opportunity to change this before we publish if needed after the next step. | ||
4. Click _"+ Auto-generate release notes"_. | ||
- This will create a summary of all of the merged pull requests since the previous release. | ||
- If you have used _[Conventional Commit Messages](https://conventionalcommits.org/)_ it will be easy to determine what types of changes were made, allowing you to ensure the correct version tag is being published. | ||
5. Now ensure the version tag selected is semantically accurate based on the changes included. | ||
6. Click _"Publish Release"_. | ||
- This will push a new tag and trigger your publishing pipeline on CircleCI. | ||
- This will push a new tag and trigger your publishing pipeline on CircleCI. | ||
|
||
## Licence | ||
|
||
MIT |
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 |
---|---|---|
@@ -1,15 +1,12 @@ | ||
version: 2.1 | ||
|
||
description: > | ||
Sample orb description | ||
What will your orb allow users to accomplish? | ||
Descriptions should be short, simple, and informative. | ||
This orb provides a command to render Go templates using Gomplate and store the output in a file. | ||
This is useful to generate dynamic configuration files for CircleCI pipelines. | ||
# This information will be displayed in the orb registry and is not mandatory. | ||
display: | ||
home_url: "https://github.com/xavientois/gomplate-orb" | ||
source_url: "https://github.com/xavientois/gomplate-orb" | ||
home_url: "https://github.com/Xavientois/gomplate-orb" | ||
source_url: "https://github.com/Xavientois/gomplate-orb" | ||
|
||
# If your orb requires other orbs, you can import them like this. Otherwise remove the "orbs" stanza. | ||
# orbs: | ||
# hello: circleci/[email protected] | ||
orbs: | ||
continuation: circleci/[email protected] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,23 @@ | ||
description: Uses curl to install the specified version of Gomplate | ||
|
||
parameters: | ||
version: | ||
type: string | ||
default: "v3.11.4" | ||
description: Version of Gomplate to install | ||
os: | ||
type: string | ||
default: "linux" | ||
description: Operating system to install Gomplate for | ||
arch: | ||
type: string | ||
default: "amd64" | ||
description: Architecture to install Gomplate for | ||
steps: | ||
- run: | ||
name: Install Gomplate | ||
environment: | ||
VERSION: << parameters.version >> | ||
OS: << parameters.os >> | ||
ARCH: << parameters.arch >> | ||
command: << include(scripts/install-gomplate.sh) >> |
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,31 @@ | ||
description: Renders the provided template and stores the output in the provided path | ||
|
||
parameters: | ||
template-file: | ||
type: string | ||
description: Template file to render as continuation pipeline | ||
output-file: | ||
type: string | ||
description: Path to write the rendered template to | ||
gomplate-config: | ||
type: string | ||
default: "" | ||
description: Path to Gomplate config file | ||
contexts: | ||
type: string | ||
default: "" | ||
description: Space-separated list of Gomplate contexts. The format for each context corresponds to the format here https://docs.gomplate.ca/usage/#context-c | ||
datasources: | ||
type: string | ||
default: "" | ||
description: Space-separated list of Gomplate data sources. The format for each datasource corresponds to the format here https://docs.gomplate.ca/usage/#datasource-d | ||
steps: | ||
- run: | ||
name: Render template | ||
environment: | ||
GOMPLATE_CONFIG: << parameters.gomplate-config >> | ||
CONTEXTS: << parameters.contexts >> | ||
DATASOURCES: << parameters.datasources >> | ||
TEMPLATE_FILE: << parameters.template-file >> | ||
OUTPUT_FILE: << parameters.output-file >> | ||
command: << include(scripts/render-template.sh) >> |
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,20 @@ | ||
description: This shows the example usage of the orb in order to generate a pipeline for dynamic config | ||
|
||
usage: | ||
version: 2.1 | ||
setup: true | ||
|
||
orbs: | ||
gomplate: xaventois/[email protected] | ||
|
||
workflows: | ||
use-my-orb: | ||
jobs: | ||
- gomplate/render-config: | ||
template-file: .circleci/continue_config.yml.tmpl | ||
output-file: .circleci/continue_config.yml | ||
pre-steps: | ||
- run: | ||
command: | | ||
echo '{ "a": "b", list: ["x", "y", "z"] }' > values.yaml | ||
contexts: values.yaml |
This file was deleted.
Oops, something went wrong.
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,30 @@ | ||
description: This shows the example usage of the orb in order to render an arbitrary template | ||
|
||
usage: | ||
version: 2.1 | ||
|
||
orbs: | ||
gomplate: xaventois/[email protected] | ||
|
||
jobs: | ||
render-greeting: | ||
executor: gomplate/gomplate | ||
steps: | ||
- run: | ||
name: "Generate greeting template and input values" | ||
command: | | ||
echo "Hello, {{ .values.name }}!" > greet.txt.tmpl | ||
echo "name: CircleCI" > values.yaml | ||
- gomplate/render-template: | ||
template-file: greet.txt.tmpl | ||
output-file: greet.txt | ||
contexts: values.yaml | ||
- run: | ||
name: "Output greeting" | ||
command: | | ||
cat test.txt | ||
workflows: | ||
greeting: | ||
jobs: | ||
- render-greeting |
Oops, something went wrong.