mirror of
https://github.com/dhall-lang/dhall-kubernetes.git
synced 2024-09-10 23:15:30 +03:00
Groundwork for supporting multiple releases
Related to https://github.com/dhall-lang/dhall-kubernetes/issues/75 This generalizes the machinery for fetching the Kubernetes OpenAPI spec to support fetching multiple versions. In particular, the Kubernetes version is no longer tied to the version of Nixpkgs that we use. We still only build generate Dhall types for version 1.16, but in a subsequent change we can start mass-generating support for multiple Dhall packages (one per Kubernetes version)
This commit is contained in:
parent
8234563d02
commit
2e3bbcdc6b
16
README.md
16
README.md
@ -305,14 +305,20 @@ in
|
||||
|
||||
## Development
|
||||
|
||||
### Updating the nixpkgs snapshot (and kubernetes version)
|
||||
### Adding a new Kubernetes releases
|
||||
|
||||
To add a new supported release, run:
|
||||
|
||||
Run
|
||||
```bash
|
||||
./scripts/update-nixpkgs.sh
|
||||
./generate.sh
|
||||
./scripts/add-kubernetes-release.sh "${VERSION}"
|
||||
```
|
||||
|
||||
If you want to make a specific release the preferred release, run:
|
||||
|
||||
```
|
||||
$ echo "${VERSION}" > ./nix/preferred.txt
|
||||
$ ./scripts/generate.sh
|
||||
```
|
||||
If the tests fail, rollback. If they don't then you have sucessfully upgraded!
|
||||
|
||||
### Tests
|
||||
|
||||
|
@ -154,14 +154,20 @@ in
|
||||
|
||||
## Development
|
||||
|
||||
### Updating the nixpkgs snapshot (and kubernetes version)
|
||||
### Adding a new Kubernetes releases
|
||||
|
||||
To add a new supported release, run:
|
||||
|
||||
Run
|
||||
```bash
|
||||
./scripts/update-nixpkgs.sh
|
||||
./generate.sh
|
||||
./scripts/add-kubernetes-release.sh "''${VERSION}"
|
||||
```
|
||||
|
||||
If you want to make a specific release the preferred release, run:
|
||||
|
||||
```
|
||||
$ echo "''${VERSION}" > ./nix/preferred.txt
|
||||
$ ./scripts/generate.sh
|
||||
```
|
||||
If the tests fail, rollback. If they don't then you have sucessfully upgraded!
|
||||
|
||||
### Tests
|
||||
|
||||
|
@ -10,6 +10,8 @@
|
||||
, stdenv
|
||||
}:
|
||||
|
||||
version:
|
||||
|
||||
let
|
||||
# Ignore generated files
|
||||
ignoreOutputs =
|
||||
@ -50,7 +52,7 @@ in
|
||||
|
||||
${coreutils}/bin/mkdir -p types defaults
|
||||
|
||||
${haskellPackages.dhall-kubernetes-generator}/bin/dhall-kubernetes-generator '${kubernetes-openapi-spec}'
|
||||
${haskellPackages.dhall-kubernetes-generator}/bin/dhall-kubernetes-generator '${kubernetes-openapi-spec."${version}"}'
|
||||
|
||||
for file in ./types.dhall ./typesUnion.dhall ./defaults.dhall ./schemas.dhall ./package.dhall ./examples/*.dhall; do
|
||||
echo "Freezing file '$file'"
|
||||
|
@ -1,9 +1,37 @@
|
||||
{stdenv, kubernetes}:
|
||||
stdenv.mkDerivation {
|
||||
name = "kubernetes-openapi-spec";
|
||||
src = kubernetes.src;
|
||||
phases = [ "unpackPhase" "installPhase" ];
|
||||
installPhase = ''
|
||||
cp api/openapi-spec/swagger.json $out
|
||||
'';
|
||||
}
|
||||
{ lib, stdenv }:
|
||||
|
||||
let
|
||||
kubernetesDirectory = ./kubernetes;
|
||||
|
||||
kubernetesPaths = builtins.readDir kubernetesDirectory;
|
||||
|
||||
toKeySpec =
|
||||
file: _:
|
||||
let
|
||||
version = builtins.replaceStrings [ ".txt" ] [ "" ] file;
|
||||
|
||||
in
|
||||
{ name = version;
|
||||
|
||||
value =
|
||||
stdenv.mkDerivation {
|
||||
name = "kubernetes-openapi-spec-${version}";
|
||||
src =
|
||||
builtins.fetchTarball {
|
||||
url = "https://github.com/kubernetes/kubernetes/archive/release-${version}.tar.gz";
|
||||
|
||||
sha256 =
|
||||
builtins.replaceStrings [ "\n" ] [ "" ]
|
||||
(builtins.readFile (kubernetesDirectory + "/${file}"));
|
||||
};
|
||||
|
||||
phases = [ "unpackPhase" "installPhase" ];
|
||||
|
||||
installPhase = ''
|
||||
cp api/openapi-spec/swagger.json $out
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
lib.mapAttrs' toKeySpec kubernetesPaths
|
||||
|
1
nix/kubernetes/0.10.txt
Normal file
1
nix/kubernetes/0.10.txt
Normal file
@ -0,0 +1 @@
|
||||
1wx9xfqd5a0srkfj15vgbhc5pxy43g76xxjm0i8lygyb2869vwb7
|
1
nix/kubernetes/0.12.txt
Normal file
1
nix/kubernetes/0.12.txt
Normal file
@ -0,0 +1 @@
|
||||
0lq8zl9v2966sa32i1kkvz9szqjdy95bdaax96fzf6wyx6gw8zjd
|
1
nix/kubernetes/0.13.txt
Normal file
1
nix/kubernetes/0.13.txt
Normal file
@ -0,0 +1 @@
|
||||
0dirl056vaj8xxj54gyfi96952983a1iwjisjz464ry9s4bamzp3
|
1
nix/kubernetes/0.14.txt
Normal file
1
nix/kubernetes/0.14.txt
Normal file
@ -0,0 +1 @@
|
||||
16p2mqafpl7sw191slx9dwg44sv8nvjh20maj7j4h269xnd3pj8y
|
1
nix/kubernetes/0.15.txt
Normal file
1
nix/kubernetes/0.15.txt
Normal file
@ -0,0 +1 @@
|
||||
0wxcdqj42ls0sdg1l2fkyka98rlr34ifakwq56f2xg2jamp3a2wm
|
1
nix/kubernetes/0.16.txt
Normal file
1
nix/kubernetes/0.16.txt
Normal file
@ -0,0 +1 @@
|
||||
1jmghxhjklypgcqr06m0yhcjwkvsa8jgc77zznq03jawy5v9jb88
|
1
nix/kubernetes/0.17.txt
Normal file
1
nix/kubernetes/0.17.txt
Normal file
@ -0,0 +1 @@
|
||||
1bbfly9k5iw0yxd2ayhl1l9ha2h5ysmak8l3dh8mkzwv7c763p7g
|
1
nix/kubernetes/0.18.txt
Normal file
1
nix/kubernetes/0.18.txt
Normal file
@ -0,0 +1 @@
|
||||
06phj5k1pjbwn8mjmlbw8k7fz60p0n1qczq0sixzxwk9n6ysfb27
|
1
nix/kubernetes/0.19.txt
Normal file
1
nix/kubernetes/0.19.txt
Normal file
@ -0,0 +1 @@
|
||||
0yk3pilr599aisi67lwcdall9jgssxv0m9iz5af26myywgqx88qw
|
1
nix/kubernetes/0.20.txt
Normal file
1
nix/kubernetes/0.20.txt
Normal file
@ -0,0 +1 @@
|
||||
14ijvyhnl1gjdnqy81msf065iv75ywwvys8hkypn6zam8vni3jk6
|
1
nix/kubernetes/0.21.txt
Normal file
1
nix/kubernetes/0.21.txt
Normal file
@ -0,0 +1 @@
|
||||
060dmbkqlcrsfwxwc20dx8nc5hni416x4sk29yfnpncgx9nzfb47
|
1
nix/kubernetes/0.4.txt
Normal file
1
nix/kubernetes/0.4.txt
Normal file
@ -0,0 +1 @@
|
||||
0rig5chq70knkxnbf21majpjb8dpfsywnpzwpj3abqldwh82nkz3
|
1
nix/kubernetes/0.5.txt
Normal file
1
nix/kubernetes/0.5.txt
Normal file
@ -0,0 +1 @@
|
||||
1jsdcwi1rzjs7snngdcwia5a0kadllwdx848ipnfvzr8lm3901x9
|
1
nix/kubernetes/0.6.txt
Normal file
1
nix/kubernetes/0.6.txt
Normal file
@ -0,0 +1 @@
|
||||
1hpq72zqwl8djg83jvi1ql14g003s8kb1c2jir7ch57d9ya5c4sl
|
1
nix/kubernetes/0.7.txt
Normal file
1
nix/kubernetes/0.7.txt
Normal file
@ -0,0 +1 @@
|
||||
02sk0csbsnf6nkhxjx5gdh0p98kfirgg4bfzvzr0ancs2vjdc6yd
|
1
nix/kubernetes/0.8.txt
Normal file
1
nix/kubernetes/0.8.txt
Normal file
@ -0,0 +1 @@
|
||||
16gg51j4yk7m6zzvi7nhlfb2nmhhp3hbq8l99hdpaj01ahbsn8f9
|
1
nix/kubernetes/0.9.txt
Normal file
1
nix/kubernetes/0.9.txt
Normal file
@ -0,0 +1 @@
|
||||
05xjwgk1gq6r3kqypbq67hrqzv8fpav4wm17xm6cals2s2xzcci2
|
1
nix/kubernetes/1.0.txt
Normal file
1
nix/kubernetes/1.0.txt
Normal file
@ -0,0 +1 @@
|
||||
188yr7x13gmi8fv77jxpx4nwz1kpr78da8xqlwpp2fd0ak3xy9x0
|
1
nix/kubernetes/1.1.txt
Normal file
1
nix/kubernetes/1.1.txt
Normal file
@ -0,0 +1 @@
|
||||
01x8sa1z10prwml4j8ybrxpdan94hh9qnkbczz7q3yrrlj8ywz7b
|
1
nix/kubernetes/1.10.txt
Normal file
1
nix/kubernetes/1.10.txt
Normal file
@ -0,0 +1 @@
|
||||
16zv5hcxhp65lryxv96dlg37ckzyjha5d70pa3yhlb19hap89hh8
|
1
nix/kubernetes/1.11.txt
Normal file
1
nix/kubernetes/1.11.txt
Normal file
@ -0,0 +1 @@
|
||||
1zifl2f4k4icgijyss25krm4ccc1a4zd5pdz2l0bc6g769dbnxgc
|
1
nix/kubernetes/1.12.txt
Normal file
1
nix/kubernetes/1.12.txt
Normal file
@ -0,0 +1 @@
|
||||
0g07k5zf9nh49b11yxikp8f7mv3a32fqx47qkbnkmnznxih0rg7f
|
1
nix/kubernetes/1.13.txt
Normal file
1
nix/kubernetes/1.13.txt
Normal file
@ -0,0 +1 @@
|
||||
1bhnhx3mzf3l311cpwfy586n9z4s08k1kqf2lvyjp10zlich6rbh
|
1
nix/kubernetes/1.14.txt
Normal file
1
nix/kubernetes/1.14.txt
Normal file
@ -0,0 +1 @@
|
||||
10h6asa6hj3a9mgf4ld7smli6fiv4grkwhd0cnbc22zwa2x69706
|
1
nix/kubernetes/1.15.txt
Normal file
1
nix/kubernetes/1.15.txt
Normal file
@ -0,0 +1 @@
|
||||
1dmjdc0l1k4mgl1bdpvgjrkksq3j5nyiqlj7nlkfgjhqh9s6ynya
|
1
nix/kubernetes/1.16.txt
Normal file
1
nix/kubernetes/1.16.txt
Normal file
@ -0,0 +1 @@
|
||||
1awapdsvp5qnaaxr20zd9lvfzrk5a2wzxpqnbyh4jhpyv22li16g
|
1
nix/kubernetes/1.17.txt
Normal file
1
nix/kubernetes/1.17.txt
Normal file
@ -0,0 +1 @@
|
||||
1fy2c2j5f61zx7vcj4pnzfpcyifm6kqxl9g9w30jq1w96r769k3i
|
1
nix/kubernetes/1.2.txt
Normal file
1
nix/kubernetes/1.2.txt
Normal file
@ -0,0 +1 @@
|
||||
1d92nykr6s9ngdnsbnbfi4zrc08f7h8d5v1pr09hyqbl9r430xnc
|
1
nix/kubernetes/1.3.txt
Normal file
1
nix/kubernetes/1.3.txt
Normal file
@ -0,0 +1 @@
|
||||
0ha2izcfvcyg1l8qrjs8c32afm9mlwvy5d33aqcfjpvy40nszzpg
|
1
nix/kubernetes/1.4.txt
Normal file
1
nix/kubernetes/1.4.txt
Normal file
@ -0,0 +1 @@
|
||||
1383iiy3n1l4vzk5wrv7dd7vl3q3mw2x4wq2k799zgxdvwp1wmbp
|
1
nix/kubernetes/1.5.txt
Normal file
1
nix/kubernetes/1.5.txt
Normal file
@ -0,0 +1 @@
|
||||
0kdycfxvmanah9cpvkxs9blhhqgpxwf49bcf1hcy2fhkibgr33v4
|
1
nix/kubernetes/1.6.3.txt
Normal file
1
nix/kubernetes/1.6.3.txt
Normal file
@ -0,0 +1 @@
|
||||
1waxkr4ycrd23w8pi83gyf6jmawi1nhfzixp70fcwwka5h7p2y91
|
1
nix/kubernetes/1.6.txt
Normal file
1
nix/kubernetes/1.6.txt
Normal file
@ -0,0 +1 @@
|
||||
0qgcxa9ra20zk7yldg5dhqmdxngm6va5x664rasda22sb4sc7x3y
|
1
nix/kubernetes/1.7.txt
Normal file
1
nix/kubernetes/1.7.txt
Normal file
@ -0,0 +1 @@
|
||||
0vrxjb6rkrmxby108h2d4vw4mxwg8q9yqx7ic0khc86adpa2x7wy
|
1
nix/kubernetes/1.8.txt
Normal file
1
nix/kubernetes/1.8.txt
Normal file
@ -0,0 +1 @@
|
||||
1jicbyy1lpah1wvqpgn0gy5m65xbm75psd951x8alfpannlk6plw
|
1
nix/kubernetes/1.9.txt
Normal file
1
nix/kubernetes/1.9.txt
Normal file
@ -0,0 +1 @@
|
||||
1ij0v3b8brkir9z45i7599zznrggds0w836p3rhp5n8rk5n1k0dj
|
@ -7,8 +7,17 @@ let
|
||||
};
|
||||
|
||||
config = {
|
||||
packageOverrides = pkgs: {
|
||||
dhall-kubernetes = pkgs.callPackage ./dhall-kubernetes.nix {};
|
||||
packageOverrides = pkgs: rec {
|
||||
make-dhall-kubernetes = pkgs.callPackage ./dhall-kubernetes.nix {};
|
||||
|
||||
dhall-kubernetes =
|
||||
let
|
||||
latestKubernetesRelease =
|
||||
builtins.replaceStrings [ "\n" ] [ "" ]
|
||||
(builtins.readFile ./preferred.txt);
|
||||
|
||||
in
|
||||
make-dhall-kubernetes latestKubernetesRelease;
|
||||
|
||||
kubernetes-openapi-spec =
|
||||
pkgs.callPackage ./kubernetes-openapi-spec.nix {};
|
||||
|
1
nix/preferred.txt
Normal file
1
nix/preferred.txt
Normal file
@ -0,0 +1 @@
|
||||
1.16
|
7
scripts/add-kubernetes-release.sh
Executable file
7
scripts/add-kubernetes-release.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
VERSION="$1"
|
||||
|
||||
nix-prefetch-url --unpack "https://github.com/kubernetes/kubernetes/archive/release-${VERSION}.tar.gz" > "nix/kubernetes/${VERSION}.txt"
|
Loading…
Reference in New Issue
Block a user