Skip to content

davidmdm/config-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CircleCI Config Compiler

The CircleCI Config Compiler is a Go library that allows you to compile CircleCI config.yml version 2.1 files to version 2.0. It provides functionality to convert and process CircleCI configuration files, enabling you to easily migrate from the newer version to the older version of the configuration format.

Usage

To compile a config.yml file from version 2.1 to version 2.0, you can use the Compile function provided by the library. Here's an example of how to use it:

package main

import (
	"fmt"
	"io"
	"log"

	"github.com/davidmdm/config-compiler/config"
)

func main() {
	// Read the source file
	source, err := io.ReadFile("path/to/config.yml")
	if err != nil {
		log.Fatal(err)
	}

	// Create a new compiler instance
	compiler := config.Compiler{}

	// Compile the source file
	compiledConfig, err := compiler.Compile(source, nil)
	if err != nil {
		log.Fatal(err)
	}

	// Save the compiled config to a file
	err = io.WriteFile("path/to/compiled-config.yml", compiledConfig, 0644)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println("Compilation successful!")
}

In the above example, the Compile function takes the source YAML file content and an optional pipelineParams map, which can be used to provide parameter values for the CircleCI configuration. The function returns the compiled configuration in YAML format.

You can customize the usage according to your specific requirements and integrate it into your Go project as needed.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages