> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# gravitee-io/keeper

Load secrets from Keeper into your CircleCI jobs.
More info: https://docs.keeper.io/secrets-manager/secrets-manager/secrets-manager-command-line-interface


## Commands

### env-export

Load a secret and make it available as an environment variable for next steps in the job.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `install-dir` | string | /tmp/keeper | Path where KSM CLI is installed |
| `secret-url` | string |  | Secret notation "url". Ex: keeper://RECORD_UID/field/password See: https://docs.keeper.io/secrets-manager/secrets-manager/secrets-manager-command-line-interface/secret-command#notation
 |
| `var-name` | string |  | Name of the environment variable to populate with the secret |

### exec

Run a command with secret environment variables loaded from Keeper

| Parameter | Type | Default | Description |
|---|---|---|---|
| `command` | string |  | Command to execute with secrets |
| `flags` | string |  | Flags to pass to the `ksm exec` command |
| `install-dir` | string | /tmp/keeper | Path where KSM CLI is installed |
| `step-name` | string |  | Title of the step to show in the CircleCI UI |

### install

Install the Keeper Secrets Manager CLI


| Parameter | Type | Default | Description |
|---|---|---|---|
| `ini_dir` | string | /tmp/keeper | The directory where the keeper.ini will be saved |
| `path` | string | /tmp/keeper | Path to install KSM CLI to |
| `shell` | string | /bin/sh | The shell used to run the install script |
| `version` | string | 1.3.0 | Version of the KSM CLI. Use latest to fetch the latest version. |

## Examples

### env_export_command

Use the keeper/env-export command to load a secret and make it available as an environment variable for next steps in the job. This is useful for providing an orb job with secrets as pre-step to the job.


```yaml
version: '2.1'
orbs:
  docker: circleci/docker@x.y.z
  keeper: gravitee-io/keeper@x.y.z
workflows:
  publish:
    jobs:
      - docker/publish:
          image: company/app
          pre-steps:
            - keeper/env-export:
                secret-url: keeper://RECORD_UID/field/login
                var-name: DOCKER_LOGIN
            - keeper/env-export:
                secret-url: keeper://RECORD_UID/field/password
                var-name: DOCKER_PASSWORD
```

### exec_command_with_secrets

Use the keeper/exec command to automatically install the Keeper Secrets Manager CLI, load secrets on demand and execute a command that needs the secrets.


```yaml
version: '2.1'
orbs:
  keeper: gravitee-io/keeper@x.y.z
jobs:
  deploy:
    docker:
      - image: cimg/base:stable
    environment:
      MY_PASSWORD: keeper://zB_JnULMlYaeCEQPE8p3HA/field/password
      MY_USER: keeper://zB_JnULMlYaeCEQPE8p3HA/field/login
    steps:
      - keeper/exec:
          command: >
            echo $MY_PASSWORD | docker login --username $MY_USER
            --password-stdin

            docker push myimage
          step-name: Docker login and push
workflows:
  publish:
    jobs:
      - deploy
```

### install_latest_version

Install a specific version of Keeper Secrets Manager CLI.


```yaml
version: '2.1'
orbs:
  keeper: gravitee-io/keeper@x.y.z
jobs:
  deploy:
    docker:
      - image: cimg/base:stable
    steps:
      - checkout
      - keeper/install:
          version: latest
      - run: ksm version
workflows:
  deploy:
    jobs:
      - deploy
```

### install_specific_version

Install a specific version of Keeper Secrets Manager CLI.


```yaml
version: '2.1'
orbs:
  keeper: gravitee-io/keeper@x.y.z
jobs:
  deploy:
    docker:
      - image: cimg/base:stable
    steps:
      - checkout
      - keeper/install:
          version: 1.0.7
      - run: ksm version
workflows:
  deploy:
    jobs:
      - deploy
```