diff --git a/README.md b/README.md index f74a64e9..55f3ca81 100644 --- a/README.md +++ b/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 diff --git a/docs/README.md.dhall b/docs/README.md.dhall index bffd772c..a0528af5 100644 --- a/docs/README.md.dhall +++ b/docs/README.md.dhall @@ -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 diff --git a/nix/dhall-kubernetes.nix b/nix/dhall-kubernetes.nix index 9f13131b..6bdc2937 100644 --- a/nix/dhall-kubernetes.nix +++ b/nix/dhall-kubernetes.nix @@ -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'" diff --git a/nix/kubernetes-openapi-spec.nix b/nix/kubernetes-openapi-spec.nix index 499418ba..ad9013a6 100644 --- a/nix/kubernetes-openapi-spec.nix +++ b/nix/kubernetes-openapi-spec.nix @@ -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 diff --git a/nix/kubernetes/0.10.txt b/nix/kubernetes/0.10.txt new file mode 100644 index 00000000..839bbc3b --- /dev/null +++ b/nix/kubernetes/0.10.txt @@ -0,0 +1 @@ +1wx9xfqd5a0srkfj15vgbhc5pxy43g76xxjm0i8lygyb2869vwb7 diff --git a/nix/kubernetes/0.12.txt b/nix/kubernetes/0.12.txt new file mode 100644 index 00000000..86369128 --- /dev/null +++ b/nix/kubernetes/0.12.txt @@ -0,0 +1 @@ +0lq8zl9v2966sa32i1kkvz9szqjdy95bdaax96fzf6wyx6gw8zjd diff --git a/nix/kubernetes/0.13.txt b/nix/kubernetes/0.13.txt new file mode 100644 index 00000000..2b8aa1a5 --- /dev/null +++ b/nix/kubernetes/0.13.txt @@ -0,0 +1 @@ +0dirl056vaj8xxj54gyfi96952983a1iwjisjz464ry9s4bamzp3 diff --git a/nix/kubernetes/0.14.txt b/nix/kubernetes/0.14.txt new file mode 100644 index 00000000..161749fc --- /dev/null +++ b/nix/kubernetes/0.14.txt @@ -0,0 +1 @@ +16p2mqafpl7sw191slx9dwg44sv8nvjh20maj7j4h269xnd3pj8y diff --git a/nix/kubernetes/0.15.txt b/nix/kubernetes/0.15.txt new file mode 100644 index 00000000..68d8a534 --- /dev/null +++ b/nix/kubernetes/0.15.txt @@ -0,0 +1 @@ +0wxcdqj42ls0sdg1l2fkyka98rlr34ifakwq56f2xg2jamp3a2wm diff --git a/nix/kubernetes/0.16.txt b/nix/kubernetes/0.16.txt new file mode 100644 index 00000000..c1d91401 --- /dev/null +++ b/nix/kubernetes/0.16.txt @@ -0,0 +1 @@ +1jmghxhjklypgcqr06m0yhcjwkvsa8jgc77zznq03jawy5v9jb88 diff --git a/nix/kubernetes/0.17.txt b/nix/kubernetes/0.17.txt new file mode 100644 index 00000000..e957923e --- /dev/null +++ b/nix/kubernetes/0.17.txt @@ -0,0 +1 @@ +1bbfly9k5iw0yxd2ayhl1l9ha2h5ysmak8l3dh8mkzwv7c763p7g diff --git a/nix/kubernetes/0.18.txt b/nix/kubernetes/0.18.txt new file mode 100644 index 00000000..ab8995b8 --- /dev/null +++ b/nix/kubernetes/0.18.txt @@ -0,0 +1 @@ +06phj5k1pjbwn8mjmlbw8k7fz60p0n1qczq0sixzxwk9n6ysfb27 diff --git a/nix/kubernetes/0.19.txt b/nix/kubernetes/0.19.txt new file mode 100644 index 00000000..2845da2a --- /dev/null +++ b/nix/kubernetes/0.19.txt @@ -0,0 +1 @@ +0yk3pilr599aisi67lwcdall9jgssxv0m9iz5af26myywgqx88qw diff --git a/nix/kubernetes/0.20.txt b/nix/kubernetes/0.20.txt new file mode 100644 index 00000000..b801c872 --- /dev/null +++ b/nix/kubernetes/0.20.txt @@ -0,0 +1 @@ +14ijvyhnl1gjdnqy81msf065iv75ywwvys8hkypn6zam8vni3jk6 diff --git a/nix/kubernetes/0.21.txt b/nix/kubernetes/0.21.txt new file mode 100644 index 00000000..a4b3d3d7 --- /dev/null +++ b/nix/kubernetes/0.21.txt @@ -0,0 +1 @@ +060dmbkqlcrsfwxwc20dx8nc5hni416x4sk29yfnpncgx9nzfb47 diff --git a/nix/kubernetes/0.4.txt b/nix/kubernetes/0.4.txt new file mode 100644 index 00000000..6b13e0c1 --- /dev/null +++ b/nix/kubernetes/0.4.txt @@ -0,0 +1 @@ +0rig5chq70knkxnbf21majpjb8dpfsywnpzwpj3abqldwh82nkz3 diff --git a/nix/kubernetes/0.5.txt b/nix/kubernetes/0.5.txt new file mode 100644 index 00000000..eba8c052 --- /dev/null +++ b/nix/kubernetes/0.5.txt @@ -0,0 +1 @@ +1jsdcwi1rzjs7snngdcwia5a0kadllwdx848ipnfvzr8lm3901x9 diff --git a/nix/kubernetes/0.6.txt b/nix/kubernetes/0.6.txt new file mode 100644 index 00000000..49618a37 --- /dev/null +++ b/nix/kubernetes/0.6.txt @@ -0,0 +1 @@ +1hpq72zqwl8djg83jvi1ql14g003s8kb1c2jir7ch57d9ya5c4sl diff --git a/nix/kubernetes/0.7.txt b/nix/kubernetes/0.7.txt new file mode 100644 index 00000000..02e996f9 --- /dev/null +++ b/nix/kubernetes/0.7.txt @@ -0,0 +1 @@ +02sk0csbsnf6nkhxjx5gdh0p98kfirgg4bfzvzr0ancs2vjdc6yd diff --git a/nix/kubernetes/0.8.txt b/nix/kubernetes/0.8.txt new file mode 100644 index 00000000..664c17ee --- /dev/null +++ b/nix/kubernetes/0.8.txt @@ -0,0 +1 @@ +16gg51j4yk7m6zzvi7nhlfb2nmhhp3hbq8l99hdpaj01ahbsn8f9 diff --git a/nix/kubernetes/0.9.txt b/nix/kubernetes/0.9.txt new file mode 100644 index 00000000..69e42874 --- /dev/null +++ b/nix/kubernetes/0.9.txt @@ -0,0 +1 @@ +05xjwgk1gq6r3kqypbq67hrqzv8fpav4wm17xm6cals2s2xzcci2 diff --git a/nix/kubernetes/1.0.txt b/nix/kubernetes/1.0.txt new file mode 100644 index 00000000..4205c1d6 --- /dev/null +++ b/nix/kubernetes/1.0.txt @@ -0,0 +1 @@ +188yr7x13gmi8fv77jxpx4nwz1kpr78da8xqlwpp2fd0ak3xy9x0 diff --git a/nix/kubernetes/1.1.txt b/nix/kubernetes/1.1.txt new file mode 100644 index 00000000..c157122e --- /dev/null +++ b/nix/kubernetes/1.1.txt @@ -0,0 +1 @@ +01x8sa1z10prwml4j8ybrxpdan94hh9qnkbczz7q3yrrlj8ywz7b diff --git a/nix/kubernetes/1.10.txt b/nix/kubernetes/1.10.txt new file mode 100644 index 00000000..aeacacde --- /dev/null +++ b/nix/kubernetes/1.10.txt @@ -0,0 +1 @@ +16zv5hcxhp65lryxv96dlg37ckzyjha5d70pa3yhlb19hap89hh8 diff --git a/nix/kubernetes/1.11.txt b/nix/kubernetes/1.11.txt new file mode 100644 index 00000000..fbd695b3 --- /dev/null +++ b/nix/kubernetes/1.11.txt @@ -0,0 +1 @@ +1zifl2f4k4icgijyss25krm4ccc1a4zd5pdz2l0bc6g769dbnxgc diff --git a/nix/kubernetes/1.12.txt b/nix/kubernetes/1.12.txt new file mode 100644 index 00000000..eea0b0c8 --- /dev/null +++ b/nix/kubernetes/1.12.txt @@ -0,0 +1 @@ +0g07k5zf9nh49b11yxikp8f7mv3a32fqx47qkbnkmnznxih0rg7f diff --git a/nix/kubernetes/1.13.txt b/nix/kubernetes/1.13.txt new file mode 100644 index 00000000..cdbea5c6 --- /dev/null +++ b/nix/kubernetes/1.13.txt @@ -0,0 +1 @@ +1bhnhx3mzf3l311cpwfy586n9z4s08k1kqf2lvyjp10zlich6rbh diff --git a/nix/kubernetes/1.14.txt b/nix/kubernetes/1.14.txt new file mode 100644 index 00000000..8ccbc256 --- /dev/null +++ b/nix/kubernetes/1.14.txt @@ -0,0 +1 @@ +10h6asa6hj3a9mgf4ld7smli6fiv4grkwhd0cnbc22zwa2x69706 diff --git a/nix/kubernetes/1.15.txt b/nix/kubernetes/1.15.txt new file mode 100644 index 00000000..7ba845c1 --- /dev/null +++ b/nix/kubernetes/1.15.txt @@ -0,0 +1 @@ +1dmjdc0l1k4mgl1bdpvgjrkksq3j5nyiqlj7nlkfgjhqh9s6ynya diff --git a/nix/kubernetes/1.16.txt b/nix/kubernetes/1.16.txt new file mode 100644 index 00000000..910deacc --- /dev/null +++ b/nix/kubernetes/1.16.txt @@ -0,0 +1 @@ +1awapdsvp5qnaaxr20zd9lvfzrk5a2wzxpqnbyh4jhpyv22li16g diff --git a/nix/kubernetes/1.17.txt b/nix/kubernetes/1.17.txt new file mode 100644 index 00000000..08d02c2d --- /dev/null +++ b/nix/kubernetes/1.17.txt @@ -0,0 +1 @@ +1fy2c2j5f61zx7vcj4pnzfpcyifm6kqxl9g9w30jq1w96r769k3i diff --git a/nix/kubernetes/1.2.txt b/nix/kubernetes/1.2.txt new file mode 100644 index 00000000..09f7e16d --- /dev/null +++ b/nix/kubernetes/1.2.txt @@ -0,0 +1 @@ +1d92nykr6s9ngdnsbnbfi4zrc08f7h8d5v1pr09hyqbl9r430xnc diff --git a/nix/kubernetes/1.3.txt b/nix/kubernetes/1.3.txt new file mode 100644 index 00000000..de9012b4 --- /dev/null +++ b/nix/kubernetes/1.3.txt @@ -0,0 +1 @@ +0ha2izcfvcyg1l8qrjs8c32afm9mlwvy5d33aqcfjpvy40nszzpg diff --git a/nix/kubernetes/1.4.txt b/nix/kubernetes/1.4.txt new file mode 100644 index 00000000..57214d43 --- /dev/null +++ b/nix/kubernetes/1.4.txt @@ -0,0 +1 @@ +1383iiy3n1l4vzk5wrv7dd7vl3q3mw2x4wq2k799zgxdvwp1wmbp diff --git a/nix/kubernetes/1.5.txt b/nix/kubernetes/1.5.txt new file mode 100644 index 00000000..ffc45bbf --- /dev/null +++ b/nix/kubernetes/1.5.txt @@ -0,0 +1 @@ +0kdycfxvmanah9cpvkxs9blhhqgpxwf49bcf1hcy2fhkibgr33v4 diff --git a/nix/kubernetes/1.6.3.txt b/nix/kubernetes/1.6.3.txt new file mode 100644 index 00000000..3d39c19d --- /dev/null +++ b/nix/kubernetes/1.6.3.txt @@ -0,0 +1 @@ +1waxkr4ycrd23w8pi83gyf6jmawi1nhfzixp70fcwwka5h7p2y91 diff --git a/nix/kubernetes/1.6.txt b/nix/kubernetes/1.6.txt new file mode 100644 index 00000000..05c70ff8 --- /dev/null +++ b/nix/kubernetes/1.6.txt @@ -0,0 +1 @@ +0qgcxa9ra20zk7yldg5dhqmdxngm6va5x664rasda22sb4sc7x3y diff --git a/nix/kubernetes/1.7.txt b/nix/kubernetes/1.7.txt new file mode 100644 index 00000000..9ed60e2c --- /dev/null +++ b/nix/kubernetes/1.7.txt @@ -0,0 +1 @@ +0vrxjb6rkrmxby108h2d4vw4mxwg8q9yqx7ic0khc86adpa2x7wy diff --git a/nix/kubernetes/1.8.txt b/nix/kubernetes/1.8.txt new file mode 100644 index 00000000..1626f94f --- /dev/null +++ b/nix/kubernetes/1.8.txt @@ -0,0 +1 @@ +1jicbyy1lpah1wvqpgn0gy5m65xbm75psd951x8alfpannlk6plw diff --git a/nix/kubernetes/1.9.txt b/nix/kubernetes/1.9.txt new file mode 100644 index 00000000..259b8714 --- /dev/null +++ b/nix/kubernetes/1.9.txt @@ -0,0 +1 @@ +1ij0v3b8brkir9z45i7599zznrggds0w836p3rhp5n8rk5n1k0dj diff --git a/nix/nixpkgs.nix b/nix/nixpkgs.nix index f7be07d1..8959b4a9 100644 --- a/nix/nixpkgs.nix +++ b/nix/nixpkgs.nix @@ -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 {}; diff --git a/nix/preferred.txt b/nix/preferred.txt new file mode 100644 index 00000000..e7151969 --- /dev/null +++ b/nix/preferred.txt @@ -0,0 +1 @@ +1.16 diff --git a/scripts/add-kubernetes-release.sh b/scripts/add-kubernetes-release.sh new file mode 100755 index 00000000..eb24c85f --- /dev/null +++ b/scripts/add-kubernetes-release.sh @@ -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"