Skip to content

Commit

Permalink
Updated overrides how to guide with new CLI command and flag names (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
sujaya-sys authored Apr 17, 2024
2 parents e0f442c + a254556 commit eeb2157
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 186 deletions.
2 changes: 1 addition & 1 deletion content/en/docs/How to/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Setup GitHub Actions"
subtitle: "Setup GitHub Actions for Continuous Integration"
linkTitle: GitHub Actions
weight: 5
weight: 1
draft: false
description: >
How to set up Score with GitHub Actions
Expand Down
56 changes: 17 additions & 39 deletions content/en/docs/How to/overrides.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
---
title: "Specify configuration overrides"
linkTitle: "Overrides"
weight: 5
weight: 2
description: >
How to define overrides for your Score specification
How to define overrides for your Score specification with score-compose
aliases:
- /docs/override/
- /docs/override/override-parameters/
---

An override is a way for you to customize or modify certain aspects of the `score.yaml` file. This can be achieved using either:
An override is a way for you to customize or modify certain aspects of the `score.yaml` file. With score-compose can be achieved using either:

- [Overrides file](#overrides-file)
- [Overrides CLI flag](#overrides-property)

Currently, these options are supported by the following Score implementation CLIs:

- `score-compose`
- `score-helm`

## Overrides file

If an `overrides.score.yaml` file is found, the Score implementation (CLI) applies overrides on the output. This occurs whether a flag is provided or not.
If an `overrides.score.yaml` file is found, the score-compose CLI applies overrides on the output. This occurs whether a flag is provided or not.

### Example: How to override a command
### How to override a command

To override the defaults declared in your `score.yaml` file, create a `overrides.score.yaml` file and declare your overrides.

1. Create a `score.yaml` file.
**1.** Create a `score.yaml` file.

```yaml
apiVersion: score.dev/v1b1
Expand All @@ -42,7 +37,7 @@ containers:
- --version
```
2. Create an `overrides.score.yaml` file and declare an override.
**2.** Create an `overrides.score.yaml` file and declare an override.

```yaml
containers:
Expand All @@ -52,51 +47,34 @@ containers:
- --help
```

3. Run the following command to override the default arguments by the `overrides.score.yaml` file.
**3.** Run the following command to override the default arguments with the contents of the `overrides.score.yaml` file.

```bash
score-compose run -f ./score.yaml \
-o ./compose.yaml \
--overrides ./overrides.score.yaml
score-compose generate score.yaml --overrides-file overrides.score.yaml
```

The following is an example output of the previous command.

```yaml
services:
run-python-app:
entrypoint:
- python
- --help
image: python3
```

**Result:** You've successfully overridden the default configuration file with a command described in your `overrides.score.yaml` file.
For more information please refer to the score-compose [examples library](https://github.com/score-spec/score-compose/tree/main/examples/07-overrides#overriding-the-score-file-with---overrides-file).

## Overrides CLI flag

With Score, you can override the declared values in your command line arguments with the `--property` flag. This is an alternative approach to using a `overrides.score.yaml` file. For details, please refer to the documentation of the implementation CLI you are using.
You can override the declared values in your command line arguments with the `--override-property` flag. This is an alternative approach to using a `overrides.score.yaml` file.

### Example: How to override a property
### How to override a property

Use the `--property` flag and specify the path to the property and the new value.
Use the `--override-property` flag and specify the path to the property and the new value.

For example, the following looks for the `containers.my-service.image` property and overrides the default image name with a value of `python3`.

```bash
score-compose run -f score.yaml --property containers.my-service.image=python3
score-compose run -f score.yaml --override-property containers.my-service.image=python3
```

### Example: How to remove a property
### How to remove a property

Set the path of the property to an empty value to remove the property.

```bash
score-compose run -f score.yaml --property metadata.my-service=
score-compose run -f score.yaml --override-property metadata.my-service=
```

For more information, see the [Score CLI reference]({{< relref "docs/score-implementation" >}}).

### Example: How to substitute a property

Use the `--property` flag to specify a placeholder substitution in resource references section.
For more information, please refer to the score-compose [examples library](https://github.com/score-spec/score-compose/tree/main/examples/07-overrides#overriding-individual-properties-in-the-score-file).
146 changes: 0 additions & 146 deletions content/en/docs/How to/score-compose.md

This file was deleted.

0 comments on commit eeb2157

Please sign in to comment.