Skip to content

Commit 56bed08

Browse files
authored
Merge pull request #104 from codedownio/modernize
Fix build for GHC 9.4 and enable GitHub Actions CI
2 parents 116f01d + 8990d26 commit 56bed08

22 files changed

+265
-96
lines changed

.github/workflows/ci.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
on: [push]
2+
name: CI
3+
jobs:
4+
cabal:
5+
name: Cabal / GHC ${{ matrix.ghc }}
6+
runs-on: ubuntu-latest
7+
strategy:
8+
fail-fast: false
9+
matrix:
10+
ghc:
11+
- "8.10.7"
12+
- "9.0.2"
13+
- "9.2.8"
14+
- "9.4.5"
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: haskell/actions/setup@v2
18+
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
23+
24+
stack:
25+
name: Stack / GHC ${{ matrix.ghc }}
26+
runs-on: ubuntu-latest
27+
strategy:
28+
fail-fast: false
29+
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"
40+
yaml: "stack.yaml"
41+
steps:
42+
- uses: actions/checkout@v3
43+
44+
- uses: haskell/actions/setup@v2
45+
with:
46+
ghc-version: ${{ matrix.ghc }}
47+
enable-stack: true
48+
stack-version: "latest"
49+
50+
- uses: actions/cache@v3
51+
name: Cache ~/.stack
52+
with:
53+
path: ~/.stack
54+
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.yaml }}
55+
56+
- name: Build
57+
run: |
58+
stack build --stack-yaml ${{matrix.yaml}} --system-ghc --test --bench --no-run-tests --no-run-benchmarks
59+
60+
- name: Test
61+
run: |
62+
stack test --stack-yaml ${{matrix.yaml}} --system-ghc

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Kubernetes Haskell Client
22

3+
[![Stack and Cabal](https://github.com/kubernetes-client/haskell/actions/workflows/ci.yml/badge.svg)](https://github.com/kubernetes-client/haskell/actions/workflows/ci.yml)
34
[![Build Status](https://travis-ci.org/kubernetes-client/haskell.svg?branch=master)](https://travis-ci.org/kubernetes-client/haskell)
45

56
Haskell client for the [kubernetes](http://kubernetes.io/) API.

cabal.project

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
packages:
2+
kubernetes
3+
kubernetes-client
4+
examples

examples/.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
dist
22
dist-newstyle
3-
*.cabal
43
.stack-work

examples/kubernetes-examples.cabal

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
cabal-version: 1.12
2+
3+
-- This file has been generated from package.yaml by hpack version 0.34.4.
4+
--
5+
-- see: https://github.com/sol/hpack
6+
7+
name: kubernetes-examples
8+
version: 0.1.0.1
9+
synopsis: Kubernetes examples with Haskell
10+
description: Examples to interact with Kubernetes using kubernetes-client and kubernetes-client-core
11+
category: Examples, Kubernetes
12+
maintainer: Shimin Guo <smguo2001@gmail.com>,
13+
Akshay Mankar <itsakshaymankar@gmail.com>
14+
license: Apache-2.0
15+
license-file: LICENSE
16+
build-type: Simple
17+
18+
executable in-cluster
19+
main-is: Main.hs
20+
other-modules:
21+
Paths_kubernetes_examples
22+
hs-source-dirs:
23+
in-cluster
24+
ghc-options: -Wall
25+
build-depends:
26+
base <5
27+
, containers
28+
, http-client
29+
, http-types
30+
, kubernetes-client
31+
, kubernetes-client-core
32+
, safe-exceptions
33+
, stm
34+
, text
35+
default-language: Haskell2010
36+
37+
executable simple
38+
main-is: Main.hs
39+
other-modules:
40+
Paths_kubernetes_examples
41+
hs-source-dirs:
42+
simple
43+
ghc-options: -Wall
44+
build-depends:
45+
base <5
46+
, containers
47+
, http-client
48+
, http-types
49+
, kubernetes-client
50+
, kubernetes-client-core
51+
, safe-exceptions
52+
, stm
53+
, text
54+
default-language: Haskell2010

examples/package.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ executables:
2222
ghc-options:
2323
- -Wall
2424
dependencies:
25-
- base
25+
- base < 5
2626
- containers
2727
- http-client
2828
- http-types

kubernetes-client/kubernetes-client.cabal

+23-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 1.12
22

3-
-- This file has been generated from package.yaml by hpack version 0.35.1.
3+
-- This file has been generated from package.yaml by hpack version 0.35.2.
44
--
55
-- see: https://github.com/sol/hpack
66

@@ -44,13 +44,15 @@ library
4444
hs-source-dirs:
4545
src
4646
ghc-options: -Wall
47+
build-tool-depends:
48+
hspec-discover:hspec-discover
4749
build-depends:
4850
aeson >=1.2 && <3
4951
, attoparsec >=0.13
5052
, base >=4.7 && <5.0
5153
, base64-bytestring
5254
, bytestring >=0.10
53-
, connection >=0.2
55+
, connection >=0.3
5456
, containers >=0.5
5557
, data-default-class >=0.1
5658
, either >=5.0
@@ -59,16 +61,17 @@ library
5961
, http-client >=0.5 && <0.8
6062
, http-client-tls >=0.3
6163
, jose-jwt >=0.8
62-
, jsonpath >=0.1 && <0.3
64+
, jsonpath >=0.1 && <0.4
6365
, kubernetes-client-core ==0.4.3.0
66+
, megaparsec ==9.*
6467
, microlens >=0.4
6568
, mtl >=2.2
6669
, oidc-client >=0.4
6770
, pem >=0.2
6871
, safe-exceptions >=0.1.0.0
6972
, stm >=2.4
70-
, streaming-bytestring >=0.1 && <0.3
71-
, text >=0.11 && <1.3
73+
, streaming-bytestring >=0.1 && <0.4
74+
, text >=0.11 && <3
7275
, time >=1.8
7376
, timerep >=2.0
7477
, tls >=1.4.1
@@ -88,13 +91,15 @@ test-suite example
8891
Paths_kubernetes_client
8992
hs-source-dirs:
9093
example
94+
build-tool-depends:
95+
hspec-discover:hspec-discover
9196
build-depends:
9297
aeson >=1.2 && <3
9398
, attoparsec >=0.13
9499
, base >=4.7 && <5.0
95100
, base64-bytestring
96101
, bytestring >=0.10
97-
, connection >=0.2
102+
, connection >=0.3
98103
, containers >=0.5
99104
, data-default-class >=0.1
100105
, either >=5.0
@@ -103,17 +108,18 @@ test-suite example
103108
, http-client >=0.5 && <0.8
104109
, http-client-tls >=0.3
105110
, jose-jwt >=0.8
106-
, jsonpath >=0.1 && <0.3
111+
, jsonpath >=0.1 && <0.4
107112
, kubernetes-client
108113
, kubernetes-client-core ==0.4.3.0
114+
, megaparsec ==9.*
109115
, microlens >=0.4
110116
, mtl >=2.2
111117
, oidc-client >=0.4
112118
, pem >=0.2
113119
, safe-exceptions >=0.1.0.0
114120
, stm >=2.4
115-
, streaming-bytestring >=0.1 && <0.3
116-
, text >=0.11 && <1.3
121+
, streaming-bytestring >=0.1 && <0.4
122+
, text >=0.11 && <3
117123
, time >=1.8
118124
, timerep >=2.0
119125
, tls >=1.4.1
@@ -138,13 +144,15 @@ test-suite spec
138144
Paths_kubernetes_client
139145
hs-source-dirs:
140146
test
147+
build-tool-depends:
148+
hspec-discover:hspec-discover
141149
build-depends:
142150
aeson >=1.2 && <3
143151
, attoparsec >=0.13
144152
, base >=4.7 && <5.0
145153
, base64-bytestring
146154
, bytestring >=0.10
147-
, connection >=0.2
155+
, connection >=0.3
148156
, containers >=0.5
149157
, data-default-class >=0.1
150158
, either >=5.0
@@ -153,20 +161,22 @@ test-suite spec
153161
, hoauth2 >=1.11 && <=3
154162
, hspec
155163
, hspec-attoparsec
164+
, hspec-megaparsec
156165
, http-client >=0.5 && <0.8
157166
, http-client-tls >=0.3
158167
, jose-jwt >=0.8
159-
, jsonpath >=0.1 && <0.3
168+
, jsonpath >=0.1 && <0.4
160169
, kubernetes-client
161170
, kubernetes-client-core ==0.4.3.0
171+
, megaparsec ==9.*
162172
, microlens >=0.4
163173
, mtl >=2.2
164174
, oidc-client >=0.4
165175
, pem >=0.2
166176
, safe-exceptions >=0.1.0.0
167177
, stm >=2.4
168-
, streaming-bytestring >=0.1 && <0.3
169-
, text >=0.11 && <1.3
178+
, streaming-bytestring >=0.1 && <0.4
179+
, text >=0.11 && <3
170180
, time >=1.8
171181
, timerep >=2.0
172182
, tls >=1.4.1

kubernetes-client/package.yaml

+8-4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ library:
1515
source-dirs: src
1616
ghc-options:
1717
- -Wall
18+
build-tools:
19+
- hspec-discover
1820
tests:
1921
spec:
2022
main: Spec.hs
@@ -23,6 +25,7 @@ tests:
2325
- kubernetes-client
2426
- hspec
2527
- hspec-attoparsec
28+
- hspec-megaparsec
2629
- yaml
2730
- file-embed
2831
example:
@@ -39,8 +42,8 @@ dependencies:
3942
- bytestring >=0.10
4043
- aeson >=1.2 && <3
4144
- attoparsec >=0.13
42-
- jsonpath >=0.1 && <0.3
43-
- connection >=0.2
45+
- jsonpath >=0.1 && <0.4
46+
- connection >=0.3
4447
- containers >= 0.5
4548
- data-default-class >=0.1
4649
- either >=5.0
@@ -50,14 +53,15 @@ dependencies:
5053
- http-client-tls >=0.3
5154
- jose-jwt >=0.8
5255
- kubernetes-client-core ==0.4.3.0
56+
- megaparsec >=9 && <10
5357
- microlens >=0.4
5458
- mtl >=2.2
5559
- oidc-client >=0.4
5660
- pem >=0.2
5761
- safe-exceptions >=0.1.0.0
5862
- stm >=2.4
59-
- streaming-bytestring >= 0.1 && < 0.3
60-
- text >=0.11 && <1.3
63+
- streaming-bytestring >= 0.1 && < 0.4
64+
- text >=0.11 && <3
6165
- time >=1.8
6266
- timerep >=2.0
6367
- tls >=1.4.1

kubernetes-client/src/Kubernetes/Client/Auth/GCP.hs

-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ where
66

77
import Control.Concurrent.STM
88
import Control.Exception.Safe (Exception, throwM)
9-
import Data.Attoparsec.Text
109
import Data.Either.Combinators
1110
import Data.Function ((&))
1211
import Data.JSONPath
@@ -126,7 +125,6 @@ parseGCPAuthInfo authInfo = do
126125
Just expiryText -> Just <$> parseExpiryTime expiryText
127126
lookupEither key = Map.lookup key authInfo
128127
& maybeToRight (GCPAuthMissingInformation $ Text.unpack key)
129-
parseK8sJSONPath = parseOnly (k8sJSONPath <* endOfInput)
130128
readJSONPath key defaultPath =
131129
maybe (Right defaultPath) parseK8sJSONPath $ Map.lookup key authInfo
132130

kubernetes-client/src/Kubernetes/Client/Auth/OIDC.hs

+8-3
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,14 @@ instance AuthMethod OIDCAuth where
6060
$ setHeader req [("Authorization", "Bearer " <> (Text.encodeUtf8 token))]
6161
& L.set rAuthTypesL []
6262

63-
data OIDCGetTokenException = OIDCOAuthException (OAuth2Error OAuth2TokenRequest.Errors)
64-
| OIDCURIException URIParseError
65-
| OIDCGetTokenException String
63+
data OIDCGetTokenException =
64+
#if MIN_VERSION_hoauth2(2,8,0)
65+
OIDCOAuthException TokenRequestError
66+
#else
67+
OIDCOAuthException (OAuth2Error OAuth2TokenRequest.Errors)
68+
#endif
69+
| OIDCURIException URIParseError
70+
| OIDCGetTokenException String
6671
deriving Show
6772
instance Exception OIDCGetTokenException
6873

0 commit comments

Comments
 (0)