Skip to content

Commit 1c438a9

Browse files
authored
Add os-release file (#177)
## Description This allows us to know at runtime the version of HookOS. Also, modified the prompt to contain the version so that when sharing screenshots to debug it will be clear the Hook version. Turned down the kernel.printk log level to warning (4) so that the console Getty doesn't get messy with kernel messages. Better UX (hopefully). A side effect of this is that we won't see messages anymore on the console when workflow action containers run. Syslog messages will still be sent to Boots. <img width="732" alt="image" src="https://github.com/tinkerbell/hook/assets/12081036/074764f3-b211-4c34-91f2-6d27511be212"> ## Why is this needed Fixes: #176 ## How Has This Been Tested? ## How are existing users impacted? What migration steps/scripts do we need? ## Checklist: I have: - [ ] updated the documentation and/or roadmap (if required) - [ ] added unit or e2e tests - [ ] provided instructions on how to upgrade
2 parents c9d440e + 5149818 commit 1c438a9

File tree

3 files changed

+56
-7
lines changed

3 files changed

+56
-7
lines changed

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,12 @@ dev: dbg-image-$(ARCH) ## Build debug mode boot files and container images for c
2929
images: ## Build release mode boot files for all supported architectures
3030
push: push-hook-bootkit push-hook-docker ## Push container images to registry
3131
run: run-$(ARCH) ## Boot system using qemu
32+
33+
.PHONY: update-os-release
34+
update-os-release: ## Update the os-release file versions
35+
## NEW_VERSION should be set from a variable passed to the make command
36+
## e.g. `make update-os-release NEW_VERSION=0.1.0`
37+
for elem in VERSION VERSION_ID; do
38+
sed -i "s/$${elem}=".*"/$${elem}="${NEW_VERSION}"/" hook.yaml
39+
done
40+
sed -i 's/PRETTY_NAME="HookOS .*"/PRETTY_NAME="HookOS ${NEW_VERSION}"/' hook.yaml

RELEASING.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,39 @@
11
# Releasing
22

3-
## Process
4-
53
For version v0.x.y:
64

5+
## Prerequisites
6+
7+
1. Update the `VERSION`, `VERSION_ID`, and `PRETTY_NAME` values in the `hook.yaml` file under `files -> "- path: etc/os-release"` to use `0.x.y`
8+
9+
```bash
10+
make update-os-release NEW_VERSION=0.x.y
11+
```
12+
13+
1. Commit, push, PR, and merge the version changes
14+
15+
```bash
16+
git commit -sm "Update version to v0.x.y" hook.yaml
17+
```
18+
19+
## Release Process
20+
721
1. Create the annotated tag
22+
823
> NOTE: To use your GPG signature when pushing the tag, use `SIGN_TAG=1 ./contrib/tag-release.sh v0.x.y` instead
9-
- `./contrib/tag-release.sh v0.x.y`
24+
25+
```bash
26+
./contrib/tag-release.sh v0.x.y
27+
```
28+
1029
1. Push the tag to the GitHub repository. This will automatically trigger a [Github Action](https://github.com/tinkerbell/hook/actions) to create a release.
30+
1131
> NOTE: `origin` should be the name of the remote pointing to `github.com/tinkerbell/boots`
12-
- `git push origin v0.x.y`
32+
33+
```bash
34+
git push origin v0.x.y
35+
```
36+
1337
1. Review the release on GitHub.
1438

1539
### Permissions

hook.yaml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ services:
2828
binds.add:
2929
- /etc/profile.d/local.sh:/etc/profile.d/local.sh
3030
- /etc/motd:/etc/motd
31+
- /etc/os-release:/etc/os-release
3132
env:
3233
- INSECURE=true
3334

@@ -96,23 +97,38 @@ files:
9697
contents: |
9798
alias docker='ctr -n services.linuxkit tasks exec --tty --exec-id cmd hook-docker docker'
9899
alias docker-shell='ctr -n services.linuxkit tasks exec --tty --exec-id shell hook-docker sh'
100+
name_version=$(grep PRETTY_NAME= /etc/os-release | cut -d'=' -f2 | tr -d '"')
101+
export PS1='${name_version}:\w\$ '
102+
# Disable kernel messages on console
103+
echo 4 > /proc/sys/kernel/printk
99104
mode: "0644"
100105

101106
- path: etc/motd
102107
mode: "0644"
108+
# This is ANSI Regular font
103109
contents: |
104110
Welcome to HookOS! Your Tinkerbell operating system installation environment.
105111
106-
██ ██ ██████ ██████ ██ ██ ██████ ███████
107-
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
112+
██ ██ ██ ██████ ███████
113+
██ ██ ██████ ██████ ██ ██ ██ ██ ██
108114
███████ ██ ██ ██ ██ █████ ██ ██ ███████
109115
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
110116
██ ██ ██████ ██████ ██ ██ ██████ ███████
111117
112-
- Press `enter` to get a prompt.
113118
- Use `docker` commands to access the tink worker/agent container and workflow action containers.
114119
- Logs are located in the `/var/log/` directory.
115120
121+
- path: etc/os-release
122+
mode: "0444"
123+
contents: |
124+
NAME="HookOS"
125+
VERSION=0.8.1
126+
ID=hookos
127+
VERSION_ID=0.8.1
128+
PRETTY_NAME="HookOS 0.8.1"
129+
ANSI_COLOR="1;34"
130+
HOME_URL="https://github.com/tinkerbell/hook"
131+
116132
- path: etc/ip/vlan.sh
117133
source: "files/vlan.sh"
118134
mode: "0777"

0 commit comments

Comments
 (0)