Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated overrides how to guide with new CLI command and flag names #95

Merged
merged 4 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
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 by the `overrides.score.yaml` file.
sujaya-sys marked this conversation as resolved.
Show resolved Hide resolved

```bash
score-compose run -f ./score.yaml \
-o ./compose.yaml \
--overrides ./overrides.score.yaml
score-compose generate score.yaml --overrides-file development.score-overrides.yaml
sujaya-sys marked this conversation as resolved.
Show resolved Hide resolved
```

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.