sonic-buildimage/files/build_templates/sonic_version.yml.j2
lguohan cf73e22d52
[build]: add branch and release name in sonic_version.yml (#6356)
the branch refers the branch name that the commit is in,
for example master, 202012, 201911, ...
In case there is no branch, the name will be HEAD.

release is encoded in /etc/sonic/sonic_release file.
the file is only available for a release branch.
It is not available in master branch.

example for master branch
```
build_version: 'master.602-6efc0a88'
debian_version: '10.7'
kernel_version: '4.19.0-9-2-amd64'
asic_type: vs
commit_id: '6efc0a88'
branch: 'master'
release: 'none'
build_date: Tue Dec 29 06:54:02 UTC 2020
build_number: 602
built_by: johnar@jenkins-worker-23
```

example for 202012 release branch
```
build_version: '202012.602-6efc0a88'
debian_version: '10.7'
kernel_version: '4.19.0-9-2-amd64'
asic_type: vs
commit_id: '6efc0a88'
branch: '202012'
release: '202012'
build_date: Tue Dec 29 06:54:02 UTC 2020
build_number: 602
built_by: johnar@jenkins-worker-23
```

Signed-off-by: Guohan Lu <lguohan@gmail.com>
2021-08-08 20:44:02 -07:00

27 lines
683 B
Django/Jinja

---
build_version: '{{ build_version }}'
{% if debian_version is defined -%}
debian_version: '{{ debian_version }}'
{% endif -%}
{% if kernel_version is defined -%}
kernel_version: '{{ kernel_version }}'
{% endif -%}
asic_type: {{ asic_type }}
commit_id: '{{ commit_id }}'
branch: '{{ branch }}'
{% if release is defined and release != '' -%}
release: '{{ release }}'
{% else -%}
release: 'none'
{% endif -%}
build_date: {{ build_date }}
build_number: {{ build_number }}
built_by: {{ built_by }}
{% if components is defined -%}
{% for component in components.split() | unique -%}
{% set name, version = component.split('==') -%}
{{ name }}: {{ version }}
{% endfor -%}
{% endif -%}