Orbs on Server Solution

Have you ever wanted to utilize Orbs on your enterprise server environment? Here is a simple technique you can add to your workflow to quickly start utilizing Orbs within your builds. This workaround to bring Orbs on server mimics the flow that occurs in CircleCI’s Cloud Product, which in its most simplistic form takes a version 2.1 configuration files and translates them into a version 2.0 configuration files.

Detailed Explanation:
CircleCI does config processing (“compilation” from 2.1 to 2.0 config) when creating a pipeline in the Cloud Platform. All v2.1 features like orbs, parameterized jobs, etc are implemented through config compilation.

This workaround uses CircleCI’s CLI to manually running the config processing that the Cloud Platform does under the hood. The CLI calls out to the same service that the config compilation does on the Cloud Platform, and executes the same thing (except for things like pipeline parameters and values).

Warning:
Below are the steps to quickly start utilizing this implementation. However, you should note that this process of config compilation will output a configuration file that Is large and will add to the debugging complexity of your configuration files. Additionally, each time you make a change to your configuration file or want to pull down updates to an Orb you must re-run this workaround.

The Steps:
1.  Write the configuration file utilizing version 2.1, referencing the orbs that you want to utilize.
2.  Save the file as: config.source.yml
3.  In a workstation that has access to the internet and has the CLI Installed run the command:
	- circleci config process .circleci/config.source.yml > .circleci/config.yml 
4.  Add the new updated config.yml file into your git workflow
5.  Run the Build
6.  (Optional Automated Workflow Approach)
	-   Configure a Pre-commit Hook utilizing Git configuration stored within the repo (repo/.git/hooks)
	-   (Initial Concept must be configured for your environment) 
		- Pre-commit Hook: [https://gist.github.com/bvanhou/665edbcefc0477b9f013c5d71123993a](https://gist.github.com/bvanhou/665edbcefc0477b9f013c5d71123993a)

References:

1 Like