Skip to content

Commit 212f6de

Browse files
authored
Merge pull request #107 from codedownio/master
Support all Kubernetes versions 1.20 through 1.30
2 parents 56bed08 + a747f6f commit 212f6de

File tree

1,014 files changed

+920207
-457891
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,014 files changed

+920207
-457891
lines changed

.github/workflows/ci.yml

+77-29
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,109 @@ on: [push]
22
name: CI
33
jobs:
44
cabal:
5-
name: Cabal / GHC ${{ matrix.ghc }}
5+
name: Cabal / K8S ${{ matrix.k8s_release }} / GHC ${{ matrix.ghc }}
66
runs-on: ubuntu-latest
77
strategy:
88
fail-fast: false
9+
# This full matrix at time of writing is 11 K8S versions * 6 compiler versions = 66,
10+
# which is a little big for CI.
11+
# Commented some older versions of each to make it manageable.
912
matrix:
13+
k8s_release:
14+
# - "1.20"
15+
# - "1.21"
16+
# - "1.22"
17+
# - "1.23"
18+
# - "1.24"
19+
- "1.25"
20+
- "1.26"
21+
- "1.27"
22+
- "1.28"
23+
- "1.29"
24+
- "1.30"
1025
ghc:
11-
- "8.10.7"
12-
- "9.0.2"
13-
- "9.2.8"
14-
- "9.4.5"
26+
# - "8.10.7"
27+
# - "9.0.2"
28+
# - "9.2.8"
29+
- "9.4.8"
30+
- "9.6.5"
31+
- "9.8.2"
1532
steps:
16-
- uses: actions/checkout@v3
17-
- uses: haskell/actions/setup@v2
33+
- uses: actions/checkout@v4
34+
35+
- uses: haskell-actions/setup@v2
1836
with:
19-
ghc-version: ${{ matrix.ghc }}
20-
cabal-version: '3.8.1.0'
21-
- run: cabal build all --enable-tests
22-
- run: cabal test all
37+
ghc-version: ${{ matrix.compiler.ghc }}
38+
cabal-version: '3.10.3.0'
39+
40+
- uses: cachix/install-nix-action@v27
41+
42+
- run: |
43+
nix run .#set-cabal-version -- "${{matrix.k8s_release}}" cabal.project
44+
cabal build all --enable-tests
45+
46+
- run: |
47+
cabal test all
2348
2449
stack:
25-
name: Stack / GHC ${{ matrix.ghc }}
50+
name: Stack / K8S ${{ matrix.k8s_release }} / GHC ${{ matrix.compiler.ghc }}
2651
runs-on: ubuntu-latest
2752
strategy:
2853
fail-fast: false
54+
# This full matrix at time of writing is 11 K8S versions * 7 compiler versions = 77,
55+
# which is a little big for CI.
56+
# Commented some older versions of each to make it manageable.
2957
matrix:
30-
include:
31-
- ghc: "8.10.7"
32-
yaml: "stack-8.10.7.yaml"
33-
- ghc: "9.0.2"
34-
yaml: "stack-9.0.2-aeson1.yaml"
35-
- ghc: "9.0.2"
36-
yaml: "stack-9.0.2-aeson2.yaml"
37-
- ghc: "9.2.8"
38-
yaml: "stack-9.2.8.yaml"
39-
- ghc: "9.4.5"
58+
k8s_release:
59+
# - "1.20"
60+
# - "1.21"
61+
# - "1.22"
62+
# - "1.23"
63+
# - "1.24"
64+
- "1.25"
65+
- "1.26"
66+
- "1.27"
67+
- "1.28"
68+
- "1.29"
69+
- "1.30"
70+
compiler:
71+
# - ghc: "8.10.7"
72+
# yaml: "stack-8.10.7.yaml"
73+
# - ghc: "9.0.2"
74+
# yaml: "stack-9.0.2-aeson1.yaml"
75+
# - ghc: "9.0.2"
76+
# yaml: "stack-9.0.2-aeson2.yaml"
77+
# - ghc: "9.2.8"
78+
# yaml: "stack-9.2.8.yaml"
79+
- ghc: "9.4.8"
80+
yaml: "stack-9.4.8.yaml"
81+
- ghc: "9.6.5"
82+
yaml: "stack-9.6.5.yaml"
83+
- ghc: "9.8.2"
4084
yaml: "stack.yaml"
4185
steps:
42-
- uses: actions/checkout@v3
86+
- uses: actions/checkout@v4
4387

44-
- uses: haskell/actions/setup@v2
88+
- uses: haskell-actions/setup@v2
4589
with:
46-
ghc-version: ${{ matrix.ghc }}
90+
ghc-version: ${{ matrix.compiler.ghc }}
4791
enable-stack: true
4892
stack-version: "latest"
4993

50-
- uses: actions/cache@v3
94+
- uses: cachix/install-nix-action@v27
95+
96+
- uses: actions/cache@v4
5197
name: Cache ~/.stack
5298
with:
5399
path: ~/.stack
54-
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.yaml }}
100+
key: ${{ runner.os }}-${{ matrix.compiler.ghc }}-${{ matrix.compiler.yaml }}
55101

56102
- name: Build
57103
run: |
58-
stack build --stack-yaml ${{matrix.yaml}} --system-ghc --test --bench --no-run-tests --no-run-benchmarks
104+
nix run .#set-stack-version -- "${{matrix.k8s_release}}" "${{matrix.compiler.yaml}}"
105+
106+
stack build --stack-yaml ${{matrix.compiler.yaml}} --system-ghc --test --bench --no-run-tests --no-run-benchmarks
59107
60108
- name: Test
61109
run: |
62-
stack test --stack-yaml ${{matrix.yaml}} --system-ghc
110+
stack test --stack-yaml ${{matrix.compiler.yaml}} --system-ghc

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ cabal.sandbox.config
1818
.stack-work/
1919
cabal.project.local
2020
.HTF/
21+
swagger.json
22+
swagger.json.unprocessed
23+
git_push.sh
24+
openapi.yaml

build_all.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
3+
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
cd "$SCRIPTDIR"
5+
6+
# This script builds kubernetes-client + kubernetes-client-core for
7+
# all Kubernetes versions.
8+
9+
nix run .#set-stack-version 1.20 stack.yaml && stack build
10+
nix run .#set-stack-version 1.21 stack.yaml && stack build
11+
nix run .#set-stack-version 1.22 stack.yaml && stack build
12+
nix run .#set-stack-version 1.23 stack.yaml && stack build
13+
nix run .#set-stack-version 1.24 stack.yaml && stack build
14+
nix run .#set-stack-version 1.25 stack.yaml && stack build
15+
nix run .#set-stack-version 1.26 stack.yaml && stack build
16+
nix run .#set-stack-version 1.27 stack.yaml && stack build
17+
nix run .#set-stack-version 1.28 stack.yaml && stack build
18+
nix run .#set-stack-version 1.29 stack.yaml && stack build
19+
nix run .#set-stack-version 1.30 stack.yaml && stack build

cabal.project

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
packages:
2-
kubernetes
2+
kubernetes-1.21
33
kubernetes-client
4-
examples
4+
examples
5+
6+
source-repository-package
7+
type: git
8+
location: https://github.com/codedownio/haskell-oidc-client
9+
tag: b70757b85751525cba41316ea9af132d9a43cfaf

flake.lock

+99
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
inputs.flake-utils.url = "github:numtide/flake-utils";
3+
inputs.gen = {
4+
url = "github:kubernetes-client/gen";
5+
flake = false;
6+
};
7+
inputs.gitignore = {
8+
url = "github:hercules-ci/gitignore.nix";
9+
inputs.nixpkgs.follows = "nixpkgs";
10+
};
11+
inputs.nixpkgs.url = "github:nixos/nixpkgs?ref=release-24.05";
12+
13+
outputs = { self, flake-utils, gen, gitignore, nixpkgs }:
14+
flake-utils.lib.eachSystem ["x86_64-linux"] (system:
15+
let
16+
pkgs = import nixpkgs { inherit system; };
17+
18+
in {
19+
packages = rec {
20+
generate = pkgs.writeShellScriptBin "generate-kubernetes-client-core.sh" ''
21+
export KUBERNETES_VERSION="$1"
22+
PACKAGE_VERSION="$2"
23+
out="kubernetes-$KUBERNETES_VERSION"
24+
25+
# Generate
26+
${pkgs.bash}/bin/bash "${gen}/openapi/haskell.sh" "$out" settings
27+
28+
# Fill in the package version
29+
${pkgs.gnused}/bin/sed -i "s/^version:\s*\(.*\)/version: $PACKAGE_VERSION/" "$out/kubernetes-client-core.cabal"
30+
31+
# Fix a bound
32+
${pkgs.gnused}/bin/sed -i 's/\(http-api-data >= 0.3.4 &&\) <0.6/\1 <0.7/' "$out/kubernetes-client-core.cabal"
33+
34+
# Delete openapi.yaml from the extra-source-files
35+
${pkgs.gnused}/bin/sed -i '/^\s*openapi\.yaml$/d' "$out/kubernetes-client-core.cabal"
36+
'';
37+
38+
set-stack-version = pkgs.writeShellScriptBin "build-kubernetes-client.sh" ''
39+
export KUBERNETES_VERSION="$1"
40+
STACK_YAML="$2"
41+
42+
${pkgs.gnused}/bin/sed -i "s/^- kubernetes-\(1\.\)[0-9]\+/- kubernetes-$KUBERNETES_VERSION/" "$STACK_YAML"
43+
'';
44+
45+
set-cabal-version = pkgs.writeShellScriptBin "build-kubernetes-client.sh" ''
46+
export KUBERNETES_VERSION="$1"
47+
CABAL_PROJECT="$2"
48+
49+
${pkgs.gnused}/bin/sed -i "s/^ kubernetes-\(1\.\)[0-9]\+/ kubernetes-$KUBERNETES_VERSION/" "$CABAL_PROJECT"
50+
'';
51+
};
52+
});
53+
}

generate_all.sh

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
3+
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
cd "$SCRIPTDIR"
5+
6+
# The first argument is the Kubernetes release to use.
7+
# The second is the package version to place in ./kubernetes-<K8S version>/kubernetes-client-core.cabal.
8+
# The idea is to use the patch number for our own purposes, incrementing when we need to update
9+
# the kubernetes-client-core library.
10+
11+
nix run .#generate -- 1.20 1.20.0
12+
nix run .#generate -- 1.21 1.21.0
13+
nix run .#generate -- 1.22 1.22.0
14+
nix run .#generate -- 1.23 1.23.0
15+
nix run .#generate -- 1.24 1.24.0
16+
nix run .#generate -- 1.25 1.25.0
17+
nix run .#generate -- 1.26 1.26.0
18+
nix run .#generate -- 1.27 1.27.0
19+
nix run .#generate -- 1.28 1.28.0
20+
nix run .#generate -- 1.29 1.29.0
21+
nix run .#generate -- 1.30 1.30.0
File renamed without changes.

kubernetes/.openapi-generator-ignore kubernetes-1.20/.openapi-generator-ignore

-2
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,3 @@
2121
#docs/*.md
2222
# Then explicitly reverse the ignore rule for a single file:
2323
#!docs/README.md
24-
25-
README.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Requested Commit/Tag : ab7d0cb74f6ef95bdaeafd327bbdb5d54f819175
2+
Actual Commit : ab7d0cb74f6ef95bdaeafd327bbdb5d54f819175

kubernetes/.openapi-generator/FILES kubernetes-1.20/.openapi-generator/FILES

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.gitignore
22
.travis.yml
3+
README.md
34
Setup.hs
45
git_push.sh
56
kubernetes-client-core.cabal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.6.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
19f91fe5110cab07889fb5816d54a140ac5072c7e6e791580eaca741a56bd203
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)