Skip to content

Commit a3e0c05

Browse files
committed
Get versions in docs from release repo.
1 parent 3b287fb commit a3e0c05

File tree

8 files changed

+93
-15
lines changed

8 files changed

+93
-15
lines changed

.github/workflows/deploy.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ jobs:
2424
- name: Build and deploy
2525
env:
2626
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27-
run: julia --color=yes --project=docs/ -e 'using Pkg; Pkg.instantiate(); include("docs/make.jl")'
27+
run: julia --color=yes --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path="/workdir")); Pkg.resolve(); include("docs/make.jl")'

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
.PHONY: build
44
build:
55
docker build -t docs-builder .
6-
docker run -it --rm -v $(PWD)/docs:/workdir/docs -w /workdir docs-builder julia --color=yes --project=docs/ -e 'using Pkg; Pkg.instantiate(); include("docs/make.jl")'
6+
docker run -it --rm -v $(PWD)/docs:/workdir/docs -w /workdir docs-builder julia --color=yes --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path="/workdir")); Pkg.resolve(); include("docs/make.jl")'

Project.toml

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
name = "Docs"
22
uuid = "e1c13cdf-5c0d-472c-a597-c85aecc67ad6"
33
version = "0.1.0"
4+
5+
[deps]
6+
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
7+
YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"
8+
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
9+
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"

docs/Manifest.toml

+36
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,30 @@ git-tree-sha1 = "88bb0edb352b16608036faadcc071adda068582a"
1717
uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
1818
version = "0.8.1"
1919

20+
[[Docs]]
21+
deps = ["HTTP", "Markdown", "Printf", "YAML"]
22+
path = "/workdir"
23+
uuid = "e1c13cdf-5c0d-472c-a597-c85aecc67ad6"
24+
version = "0.1.0"
25+
2026
[[Documenter]]
2127
deps = ["Base64", "Dates", "DocStringExtensions", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "REPL", "Test", "Unicode"]
2228
git-tree-sha1 = "395fa1554c69735802bba37d9e7d9586fd44326c"
2329
uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
2430
version = "0.24.11"
2531

32+
[[HTTP]]
33+
deps = ["Base64", "Dates", "IniFile", "MbedTLS", "Sockets"]
34+
git-tree-sha1 = "ec87d5e2acbe1693789efbbe14f5ea7525758f71"
35+
uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3"
36+
version = "0.8.15"
37+
38+
[[IniFile]]
39+
deps = ["Test"]
40+
git-tree-sha1 = "098e4d2c533924c921f9f9847274f2ad89e018b8"
41+
uuid = "83e8ac13-25f8-5344-8a64-a9f2b223428f"
42+
version = "0.5.0"
43+
2644
[[InteractiveUtils]]
2745
deps = ["Markdown"]
2846
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
@@ -47,6 +65,18 @@ uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
4765
deps = ["Base64"]
4866
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
4967

68+
[[MbedTLS]]
69+
deps = ["Dates", "MbedTLS_jll", "Random", "Sockets"]
70+
git-tree-sha1 = "426a6978b03a97ceb7ead77775a1da066343ec6e"
71+
uuid = "739be429-bea8-5141-9913-cc70e7f3736d"
72+
version = "1.0.2"
73+
74+
[[MbedTLS_jll]]
75+
deps = ["Libdl", "Pkg"]
76+
git-tree-sha1 = "c83f5a1d038f034ad0549f9ee4d5fac3fb429e33"
77+
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
78+
version = "2.16.0+2"
79+
5080
[[Mmap]]
5181
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
5282

@@ -91,3 +121,9 @@ uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
91121

92122
[[Unicode]]
93123
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
124+
125+
[[YAML]]
126+
deps = ["Base64", "Dates", "Printf"]
127+
git-tree-sha1 = "c5e2eaa5ce818c5277388377d592eb4c81f27c00"
128+
uuid = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"
129+
version = "0.4.0"

docs/Project.toml

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[deps]
2+
Docs = "e1c13cdf-5c0d-472c-a597-c85aecc67ad6"
23
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
34

45
[compat]

docs/src/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Not only does the metal-stack run smoothly on [Kubernetes](https://kubernetes.io
3737

3838
From the perspective of the Gardener, the metal-stack is just another cloud provider. The time savings compared to providing machines and Kubernetes by hand are significant. We actually want to be able to compete with offers of public cloud providers, especially regarding speed and usability.
3939

40-
Of course, you can use metal-stack only for machine provisioning as well and just put something else on top of the metal infrastructure.
40+
Of course, you can use metal-stack only for machine provisioning as well and just put something else on top of the metal infrastructure.
4141

4242
### Open Source
4343

docs/src/installation/deployment.md

+33-12
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,26 @@ Let's now create the following files and folder structures:
6060

6161
The `requirements.yaml` is used for declaring [Ansible Galaxy](https://galaxy.ansible.com/) role depedencies. It will dynamically provide the [metal-roles](https://github.com/metal-stack/metal-roles) and the [ansible-common](https://github.com/metal-stack/ansible-common) role when starting the deployment. The file should contain the following dependencies:
6262

63+
````@eval
64+
using Docs
65+
66+
ansible_common = releaseVector()["ansible-roles"]["ansible-common"]["version"]
67+
metal_roles = releaseVector()["ansible-roles"]["metal-roles"]["version"]
68+
69+
t = """
6370
```yaml
6471
---
6572
- src: https://github.com/metal-stack/ansible-common.git
6673
name: ansible-common
67-
version: v0.5.2
74+
version: %s
6875
- src: https://github.com/metal-stack/metal-roles.git
6976
name: metal-roles
70-
version: v0.1.12
77+
version: %s
7178
```
79+
"""
80+
81+
printMarkdown(t, ansible_common, metal_roles)
82+
````
7283

7384
!!! tip
7485

@@ -147,21 +158,21 @@ Basically, this playbook does the following:
147158

148159
Next you will need to parametrize the referenced roles to fit your requirements. The variables of the role dependencies can be looked up in the role documention on [metal-roles/control-plane](https://github.com/metal-stack/metal-roles/tree/master/control-plane). You should not need to define a lot of variables here for now, most values are reasonably defaulted in the roles. Just make sure you define all the "required" variables in your `group_vars/control-plane/all.yaml`, which looks like this:
149160

161+
````@eval
162+
using Docs
163+
164+
t = """
150165
```yaml
151166
---
152167
# common defaults
153168
metal_control_plane_ingress_dns: <your-dns-domain> # if you are trying this with a local setup, you can consider using xip.io
154169
155-
# image versions
156-
metal_api_image_tag: v0.7.5
157-
metal_metalctl_image_tag: v0.7.5
158-
metal_masterdata_api_image_tag: v0.7.1
159-
metal_console_image_tag: v0.4.1
160-
161-
metal_db_backup_restore_sidecar_image_tag: v0.5.1
162-
ipam_db_backup_restore_sidecar_image_tag: v0.5.1
163-
masterdata_db_backup_restore_sidecar_image_tag: v0.5.1
170+
metal_stack_version: %s
164171
```
172+
"""
173+
174+
printMarkdown(t, releaseVersion())
175+
````
165176
166177
By the time you will certainly add more parametrization to the deployment. When this happens, feel free to split up your `all.yaml` into separate files to keep everything nice and pretty.
167178
@@ -182,20 +193,30 @@ This is how your `roles/ingress-controller/tasks/main.yaml` could look like:
182193
183194
Now, it should be possible to run the deployment through a Docker container. Make sure to have the [Kubeconfig file](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/) of your cluster and set the path in the following command accordingly:
184195
196+
````@eval
197+
using Docs
198+
199+
base_image = releaseVector()["docker-images"]["metal-stack"]["generic"]["deployment-base"]["tag"]
200+
201+
t = raw"""
185202
```bash
186203
export KUBECONFIG=<path-to-your-cluster-kubeconfig>
187204
docker run --rm -it \
188205
-v $(pwd):/workdir \
189206
--workdir /workdir \
190207
-e KUBECONFIG="${KUBECONFIG}" \
191208
-e K8S_AUTH_KUBECONFIG="${KUBECONFIG}" \
192-
metalstack/metal-deployment-base:v0.0.5 \
209+
metalstack/metal-deployment-base:%s \
193210
/bin/bash -ce \
194211
"ansible-galaxy install -r requirements.yaml
195212
ansible-playbook \
196213
-i inventories/control-plane.yaml \
197214
deploy_metal_control_plane.yaml"
198215
```
216+
"""
217+
218+
printMarkdown(t, base_image)
219+
````
199220
200221
!!! tip
201222

src/Docs.jl

+14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
11
module Docs
2+
using YAML, HTTP, Markdown, Printf
23

4+
export releaseVersion, releaseVector, printMarkdown
5+
6+
releaseVersion() = "master"
7+
releaseVector() = release_vector
8+
9+
r = HTTP.request("GET", string("https://raw.githubusercontent.com/metal-stack/releases/", releaseVersion(), "/release.yaml"))
10+
release_vector = YAML.load(String(r.body))
11+
12+
constsprintf(fmt::String,args...) = @eval @sprintf($fmt,$(args...))
13+
14+
function printMarkdown(t, x...)
15+
return Markdown.parse(constsprintf(t, x...))
16+
end
317
end

0 commit comments

Comments
 (0)