Attini configuration

The Attini Framework will look for a file in your distributions root directory called attini-config.json, attini-config.yml or attini-config.yaml. Only one of these files are allowed.

Note

This file is not required but its highly recommend to create one.

The attini-config should at the minimum contain a distributionName. Using the name in attini-config file, Attini will give your distribution a namespace in S3 and SSM Parameter Store, which separates your distribution from other distributions. A new deployment with the same distributionName will create a new version of the same distribution.

We also recommend to automatically set the distributionId using a script in your build server. The git commit id is a excellent value for the distributionId because it will be easy for you to see what code runes in your environments. It can also be a good idea to append a timestamp to the id so that you can re-build with same commit.

Note

If the distributionId is missing from the attini-config, a new GUID will be used every deploy so you will not be able to trace distributions across multiple environments.

Json

{
  "distributionName": "String",
  "distributionId": "String",
  "distributionTags": {
    "String": "String"
  },
  "initDeployConfig": {
    "template": "String",
    "stackName": "String",
    "parameters": {
      "String": {
        "String": "String"
      }
    },
    "tags":{
      "String": "String"
    }
  },
  "package": {
    "prePackage": {
      "commands": [
        "String"
      ]
    },
    "postPackage": {
      "commands": [
        "String"
      ]
    }
  }
}

Yaml

distributionName: String
distributionId: String
distributionTags:
  String: String
initDeployConfig:
  template: String
  stackName: String
  parameters:
    String:
      String: String
  tags:
    String: String
package:
  prePackage:
    commands:
      - String

  postPackage:
    commands:
      - String

distributionName

Type: String

Minimum 2 and maximum 128 characters. Allow characters: “a-z”, “A-Z”, “0-9” and “-_.”.

We recommend that the distributionName is the same as the Git repository to make it easy to understand. But this is not a requirement, sometimes a distribution consist of a combination of many git repository’s and/or external resources, and sometimes it makes sense to split a repository up into many different distributions.

Default: To the name of the distribution zip file.

Required: No

distributionId

Type: String

Minimum 2 and maximum 128 characters. Allow characters: “a-z”, “A-Z”,”0-9” and “-_.”.

We recommend that the distributionId is the same as the git commit that triggered the build, this gives an excellent transparency of what is running in your environments. But this is not a requirement, if your organization have a strict semantic version policy that might make more sense to you.

We highly recommend that your build server configures this value automatically every time it builds a distribution to ensure that it is unique

Default: A guid.

Required: No

distributionTags

Type: Map<String,String>

Metadata that is relevant to your organization or distribution. Some normal use-cases include:

  • Keep track of git branch that was the source of the distribution

  • Add additional version information like semantic version, git commit id etc

  • Build time

  • Build agent/build container

  • If your distribution consists of a combination of git repository’s, this is a good place to store the git commit of those repository’s

Attini will treat these tags as first class citizens in the Framework to we will be searchable and we will tag all our resources with it.

See limitations

Required: No

initDeployConfig

Type: initDeployConfig

Configuration for the Init deploy.

Within this object you can use distributionName and environment as sub string parameters, see examples below.

Required: No


initDeployConfig

initDeployConfig template

Type: String

Path the the init deploy template.

Required: No

initDeployConfig stackName

Type: String

Init deploy stack name.

Required: No

initDeployConfig parameters

Type: Map<String,Map<String,String>>

Parameters for the init deploy, the key should be the environment name.

Anything under “default” will supplement the environment specific config.

Required: No

initDeployConfig tags

Type: Map<String,String>

Init deploy stack tags.

Required: No


Variables in initDeployConfig config

Within initDeployConfig you can use automatic variables for your stack config (ex the stack name or the tags)

environment

Will always transform to the current environment name.

Usage: ${environment}

distributionName

Will always convert to the current distributionName name.

Usage: ${distributionName}

package

Under the package section you can list any shell commands you want to execute when packaging a distribution using the attini package command. The attini deploy run command will also perform a package assuming the path supplied points is to a directory.

The Attini CLI will create a temp working directory when packaging a distribution. Therefore you can manipulate any resources without it effecting the original files.

The path to the temp directory will be stored in the ATTINI_WORK_DIR environment variable during the execution of package commands.

prePackage commands

Type: List<String

List of shell commands that is executed before the final distribution i created.

Useful if you for example want to configure the distribution (see attini configure command) or fetch external resources to be included in the distribution.

Required: No

postPackage commands

Type: List<String

List of shell commands that is executed before the final distribution i created but before the final distribution is copied from the temp working directory.

Useful if you for example want to move the distribution somewhere after the packaging is done.

Required: No

Examples

Json

{
  "distributionName": "network",
  "distributionId": "3957876a98566823744050eef132c133536ea32b",
  "distributionTags": {
    "Version": "1.1.2",
    "Branch": "feature/add-nlb"
  }
}
{
  "distributionName": "platform",
  "distributionId": "67e13cb77e9139929057602a46229cf0162c8747",
  "distributionTags": {
    "version": "1.1.2",
    "branch": "hotfix/bugfix"
  },
  "initDeployConfig": {
    "template": "pipeline.yaml",
    "stackName": "${environment}-${distributionName}-init-deploy",
    "parameters": {
      "default": {
        "containerTag": "latest"
      },
      "dev": {
        "containerTag": "1.0.11"
      }
    },
    "tags": {
      "dev": {
        "costCenter": "Development"
      },
      "prod": {
        "costCenter": "Sales"
      }
    }
  },
  "package": {
    "prePackage": {
      "commands": [
        "echo $ATTINI_WORK_DIR",
        "export AWS_PROFILE=MyProfile",
        "attini configure set-dist-id --override --random",
        "attini configure set-tag --key version --value echo `1.0.2`"
      ]
    },
    "postPackage": {
      "commands": [
        "echo \"done with package\""
      ]
    }
  }
}

Yaml

distributionName: network
distributionId: 3957876a98566823744050eef132c133536ea32b
distributionTags:
  version: 1.1.2
  branch: feature/add-nlb
distributionName: platform
distributionId: 67e13cb77e9139929057602a46229cf0162c8747
distributionTags:
  version: 1.1.2
  branch: hotfix/bugfix
initDeployConfig:
  template: pipeline.yaml
  stackName: "${environment}-${distributionName}-init-deploy"
  parameters:
    default:
      containerTag: latest
    dev:
      containerTag: 1.0.11
  tags:
    dev:
      costCenter: Development
    prod:
      costCenter: Sales
  package:
    prePackage:
      commands:
        - echo $ATTINI_WORK_DIR
        - export AWS_PROFILE=MyProfile
        - attini configure set-dist-id --override --random
        - attini configure set-tag --key version --value echo `1.0.2`

    postPackage:
      commands:
        - echo "done with package"