# HLD - High Level Definition

Initialize a Bedrock HLD (High Level Definition) repository and deploy pipelines
to materalize manifests.

Usage:

```
spk hld [command] [options]
```

Commands:

- [HLD - High Level Definition](#hld---high-level-definition)
  - [Requirements](#requirements)
  - [Commands](#commands)
    - [init](#init)
    - [install-manifest-pipeline](#install-manifest-pipeline)

Global options:

```
  -v, --verbose        Enable verbose logging
  -h, --help           Usage information
```

## Requirements

There are a few base assumptions that `spk` makes, as this will affect the set
up of pipelines:

1. Both HLD and manifest repositories are within a single Azure DevOps project.
2. The access token being utilized via `spk` has access to both repositories.
   - [Documentation on how to create a Personal Access Token](https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops)

Configure SPK using the configuration provided in your `.spk-config` file. The
configuration section under `azure_devops` _must_ be provided for SPK to
properly configure pipelines in your Azure DevOps organization.

An example configuration is as follows:

```
azure_devops:
  org: "https://dev.azure.com/bhnook"
  project: "fabrikam"
  hld_repository: "dev.azure.com/bhnook/fabrikam/_git/hld"
  manifest_repository: "dev.azure.com/bhnook/fabrikam/_git/materialized"
  access_token: "sdjkhasdxa3dw4jkhgf4zyv7t" # This is your Personal Access Token with permission to modify and access both hld and manifest repositories.
```

## Commands

### init

Initialize the HLD repository by creating an `azure-pipelines.yaml` file, if one
does not already exist.

```
Usage: spk hld init|i [options]

Initialize your hld repository. Will add the azure-pipelines yaml files to your working directory/repository if it does not already exist.

Options:
  --git-push  SPK CLI will try to commit and push these changes to a new origin/branch. (default: false)
  -h, --help  output usage information

```

### install-manifest-pipeline

After merging the azure-pipelines yaml file generated by the init step above
into the `master` branch, run the following command to install the HLD to
Manifest pipeline. This pipeline will be triggered on commits to master and
invoke "manifest generation"
[(via fabrikate)](https://github.com/microsoft/fabrikate), rendering helm charts
and configuration into Kubernetes yaml.

```
Usage: spk hld install-manifest-pipeline|m [options]

Install the manifest generation pipeline to your Azure DevOps instance

Options:
  -h, --help  output usage information
```
