Hydra complains about the branch name with:
```
hydra-eval-jobs returned exit code 1:
error: worker error: invalid Git branch/tag name 'refs/heads/nixos-unstable'
```
... and the branch name is not necessary anyway
Fixes https://github.com/dhall-lang/dhall-kubernetes/issues/86
The motivation of this is to more accurately model the Kubernetes
API semantics by not auto-omitting empty fields. This is because
a field set to `Some ([] : List T)` is not necessarily the same
as `None (List T)`.
This makes the typical case a bit more verbose (more `Some`s), but
the difference to the `./examples` shows that it's not too bad.
This improves the granularity of the Nix build graph in order to minimize
unnecessary rebuilds.
This also fixed several bugs in the package generation along the way, so
this change includes those fixes.
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.
Related to https://github.com/dhall-lang/dhall-kubernetes/issues/75
In order to support multiple versions of the Kubernetes API we need to begin
automating the process of excluding duplicate resources (otherwise the
maintenance burden would be far too high). This change adds new support
for automatically preferring Kubernetes resources by version where:
* v2 is prioritized over v1
* production is prioritized over beta, which is prioritized over alpha
Note that even when prioritizing by version there are still a few cases of
duplicates. For now we use the default behavior of `Data.List.maximumBy`
to select the last resource if there are still conflicts. This leads to
a few differences in which resources are preferred when such a conflict
arises (where previously we were just guessing manually which one to pick).
* Add a `package.dhall` file, which re-exports `schemas.dhall` and adds
`IntOrString`. The expected hash of `package.dhall` is currently:
sha256:3ea8628b704704de295261dfc7626c15247c589c10a266f970cade262543fdda
* Update documentation and examples to clarify that expected usage is
through the `package.dhall` file.
* README.md cleanup: Update tutorial reference URL to the latest `1.28`
release of `dhall-haskell`, and change code language hints from
`haskell` to `dhall`.
For lack of a better term, I'm calling the `{ Type = …, default = … }`
record that the record completion operator expects a "schema". This
change adds `dhall-kubernetes` support for auto-generating these schemas
for ease of use with the new `::` operator.
See the included example for how this would be used
According to the Kubernetes documentation [1]:
Note: CronJob resource in batch/v2alpha1 API group has been deprecated
starting from cluster version 1.8. You should switch to using
batch/v1beta1, instead, which is enabled by default in the API server.
Examples in this document use batch/v1beta1 in all examples.
[1]: https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/
In the case that an older kubernetes openapi is used, some of the
excluded models for newer versions will cause a necessary object for the
older kubernetes version to be filtered. In this case, showing the Kind
is helpful for debugging.
This ports the conversion script from Python to Haskell (fix#7)
The main reasons for this port are that:
- the Python script was really hard to maintain for reasons like
"converting from Swagger to Dhall is interleaved with string formatting"
- in Haskell we can use the dhall library to generate always syntactically
correct Dhall AST. It's also much easier to keep an eye on correctness,
because types and pattern matching. It also forces us to deal with things
like cyclic imports from the get go.
Things happening here:
- remove the `api` folder, removing the difference between "raw api" and "nice api"
- move defaults from `default` to `defaults` folder, as it is in `dhall-nethack`
- transition to the new syntax for `Optional` (fix#49)
- add `types.dhall` and `defaults.dhall`, so that one can now easily "pin a version"
by just importing these two records at a specific commit/tag. They also make it really
easy to access objects, e.g.
`let types = https://raw.githubusercontent... sha256:... in types.Deployment`
- also add typesUnion.dhall (fix#54), so one is able to send to Kubernetes different
objects in the same stream. This is also documented in the README
- defaults are resolved recursively (fix#46): if there's an import of a "nullable" record,
then it's not marked as Optional, making merging objects much easier
- default objects are not lambdas anymore, and instead they just don't include the required
fields (that is, the ones that are not nullable records), as suggested in dhall-lang/dhall-lang#382
- for objects that are simple types we used to generate a simple lambda
`\(a : Text) -> a` as a default, now we just don't generate a default (e.g. see
`io.k8s.apimachinery.pkg.apis.meta.v1.Time`)
- autoformat all generated Dhall code
- remove cyclic imports (fix#47)
- update to dhall-1.22 and dhall-json-1.2.8
This makes our build reproducible and consistent
* Disables dhall tests. They don't build in sandbox mode because they require network access
* Moves all scripts to ./scripts folder for consistency
* Moves all nix files to ./nix folder for consistency, except for release.nix which Hydra needs
* Changes convert.py to take the K8s swagger spec as an argument
* Get k8s swagger spec from nixpkgs
* Get dhall prelude from nixpkgs
* added an ./scripts/update-nixpkgs.sh script to easily update to a new version of nixpkgs