Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
48 changes: 48 additions & 0 deletions .github/workflows/publish-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: docker-image-push

on:
push:
tags: [ '*' ]

env:
REGISTRY: ghcr.io
IMAGE_NAME: adobe/himl

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM python:3.10.1-slim@sha256:73561a44fb5c181399a3dc21513e2188a62f052826bd4e15b0ddc5fe4a676c31

WORKDIR /config-merger

ADD . /config-merger/

RUN apt-get update && apt-get install -y make curl

RUN python -m pip install --upgrade pip && pip3 install -r requirements.txt
RUN pip3 install .
RUN rm -rf /config-merger/*
57 changes: 32 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,31 @@ It is ideal if you want to structure your hierarchy in such a way that you avoid

Idea came from puppet's hiera.

## Table of Contents

1. [Installation](#installation)
2. [Examples](#examples)
3. [Features](#features)
* [Interpolation](#feature-interpolation)
* [Deep merge](#feature-deep-merge)
* [Secrets retrieval](#feature-secrets-retrieval)
* [Merge with Terraform remote state](#feature-terraform-remote-state)

<a name="installation"/>
## Table of Contents

- [himl](#himl)
- [Description](#description)
- [Table of Contents](#table-of-contents)
- [Installation](#installation)
- [Using `pip`](#using-pip)
- [Using `docker` image](#using-docker-image)
- [From Source](#from-source)
- [Examples](#examples)
- [Using the python module](#using-the-python-module)
- [Using the cli](#using-the-cli)
- [Features](#features)
- [Interpolation](#interpolation)
- [Interpolating simple values](#interpolating-simple-values)
- [Interpolating whole `dict`](#interpolating-whole-dict)
- [Deep merge](#deep-merge)
- [Secrets retrieval](#secrets-retrieval)
- [AWS SSM](#aws-ssm)
- [AWS S3](#aws-s3)
- [Vault](#vault)
- [Merge with Terraform remote state](#merge-with-terraform-remote-state)
- [Merge with env variables](#merge-with-env-variables)
- [himl config merger](#himl-config-merger)
- [Extra merger features](#extra-merger-features)

## Installation

Expand All @@ -31,6 +45,13 @@ Idea came from puppet's hiera.
pip install himl
```

### Using `docker` image

```sh
docker run ghcr.io/adobe/himl:latest himl-config-merger --help
```
See all docker tags at: https://github.com/adobe/himl/pkgs/container/himl/versions

### From Source

```
Expand All @@ -39,8 +60,6 @@ cd himl
sudo python setup.py install
```

<a name="examples"/>

## Examples

### Using the python module
Expand Down Expand Up @@ -70,8 +89,6 @@ examples/simple
└── env.yaml
```

<a name="deep-merge-example"/>

The example also showcases deep merging of lists and maps.

`examples/simple/default.yaml`
Expand Down Expand Up @@ -162,12 +179,8 @@ examples/complex
└── region.yaml
```

<a name="features"/>

## Features

<a name="feature-interpolation"/>

### Interpolation

In order to avoid repetition, we wanted to make it possible to define a value once and reuse it in other parts of the yaml config.
Expand Down Expand Up @@ -208,15 +221,11 @@ tagging: "{{projects.webapp1.tagging}}"
tagging: "{{projects.{{project.name}}.tagging}}"
```

<a name="feature-deep-merge"/>

### Deep merge

It's possible to have the same key (eg. a dict/list) in multiple files and combine them using a deep merge.
See an example [here](https://github.com/adobe/himl#deep-merge-example).

<a name="feature-secrets-retrieval"/>

### Secrets retrieval

#### [AWS SSM](https://docs.aws.amazon.com/systems-manager/latest/userguide/integration-ps-secretsmanager.html)
Expand Down Expand Up @@ -250,8 +259,6 @@ Generate a token for a policy:
my_token: "{{vault.token_policy(my_vault_policy)}}"
```

<a name="feature-terraform-remote-state"/>

### Merge with [Terraform remote state](https://www.terraform.io/docs/state/remote.html)

```yaml
Expand Down