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

Rendering the application version in the helm chart #6390

Closed
1 task done
yury-k8 opened this issue Nov 5, 2024 · 3 comments
Closed
1 task done

Rendering the application version in the helm chart #6390

yury-k8 opened this issue Nov 5, 2024 · 3 comments

Comments

@yury-k8
Copy link

yury-k8 commented Nov 5, 2024

Before proceeding

  • I didn't find a similar issue

Problem

The project maintains the value of the application version. The value can be read from a file in the root of the project. This value must be assigned to the application deployment labels. At the moment, it is possible to set only in Chart.yaml. This option is not useful.

Solution (if you have one)

It is proposed to make it possible to template Chart.yaml with access to files in the root of the project (not in the Helm folder of the chart) or to set a parameter in templating werf.yaml with subsequent templating of the Deployment manifest.

Additional information

No response

@github-actions github-actions bot added the triage label Nov 5, 2024
@Aleksey-Kalinin
Copy link

Поддерживаю шаблонизацию Chart.yaml и values.yaml, а также доступ из шаблонов к файлам вне проекта Helm

@drey
Copy link
Contributor

drey commented Nov 18, 2024

I'm going to implement this feature, but would prefer to discuss some questions before getting started.

@alexey-igrychev is it handy to be able to read the app version from a dedicated file or it is fine to have it only in the werf.yaml? If reading version from an external file is desired, what file formats should we consider? Basically we can support everything, but a lot of options is not always good.

With the external version file support I see the following scenarios:

  1. Plaint text file. The versions should be at the first line. No special formatting rules.
  2. YAML or JSON file. The content is not matter as long as we have a version key at the top level. For instance:
---
version: "0.0.1"
...

drey added a commit to drey/werf that referenced this issue Nov 24, 2024
Implements werf#6390

The current implementation scope:

	* Add `applicationVersion` global param support to `werf.yml`
	* Add `applicationVersionFile` global param support to `werf.yml`
        * Plain/text, JSON, YAML files can be used as `applicationVersionFile` params
	* Giterminism is enforced for `applicationVersionFile` param
	* Gitemenis dev mode is supported for `applicationVersionFile` param
	* Handle corner case when both `applicationVersion` and `applicationVersionFile` params are set
	* `applicationVersion` value is available in nelm templates by using `$.Values.werf.applicationVersion` variable

`werf.yaml` file content:
```
project: demo-app
configVersion: 1
applicationVersion: v0.0.1

---
image: backend
dockerfile: backend.Dockerfile

---
image: frontend
dockerfile: frontend.Dockerfile

```

`werf.yaml` file content:
```
project: demo-app
configVersion: 1
applicationVersionFile: ./version.json

---
image: backend
dockerfile: backend.Dockerfile

---
image: frontend
dockerfile: frontend.Dockerfile

```
`./version.json` file content:
```
{
    "version": "v0.0.1"
}
```

`werf.yaml` file content:
```
project: demo-app
configVersion: 1
applicationVersionFile: ./version.yaml

---
image: backend
dockerfile: backend.Dockerfile

---
image: frontend
dockerfile: frontend.Dockerfile

```
`./version.yaml` file content:
```
version: v0.0.1
```

`werf.yaml` file content:
```
project: demo-app
configVersion: 1
applicationVersionFile: ./version

---
image: backend
dockerfile: backend.Dockerfile

---
image: frontend
dockerfile: frontend.Dockerfile

```
`./version` file content:
```
v0.0.1
```
drey added a commit to drey/werf that referenced this issue Dec 3, 2024
drey added a commit to drey/werf that referenced this issue Dec 4, 2024
@alexey-igrychev
Copy link
Member

solved

iapershin pushed a commit that referenced this issue Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants