Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use modern base64 #642

Merged
merged 7 commits into from
Mar 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### v0.12.3

- Add missing dependency on Base64 and port to >=3.0.0 interface (@avsm)
- Adapt to crunch.3.0.0 interface (@hannesm)
- Use non-deprecated Yojson types in 1.7.0 and higher (@avsm)

### 0.12.2 (2019-01-18)

- Support the latest GitHub and Atd bindings (>=2.0.0) (@avsm)
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ RUN sudo apk add --no-cache tzdata aspcud gmp-dev perl libev-dev m4
ENV OPAMERRLOGLEN=0 OPAMYES=1

RUN git -C /home/opam/opam-repository fetch origin && \
git -C /home/opam/opam-repository reset da99aec5e0ecc83bd86926b620eff45b99c82c26 --hard && \
git -C /home/opam/opam-repository reset b01a2e4e1ac2fb545d593ad40bc95b4a78dec9e2 --hard && \
opam update -u

RUN opam install alcotest lwt conf-libev inotify
Expand Down Expand Up @@ -33,7 +33,7 @@ RUN opam install datakit -ytv
RUN sudo cp $(opam config exec -- which datakit) /usr/bin/datakit && \
sudo cp $(opam config exec -- which datakit-mount) /usr/bin/datakit-mount

FROM alpine:3.8
FROM alpine:3.9
RUN apk add --no-cache libev gmp tzdata ca-certificates git openssh-client bash
EXPOSE 5640
ENTRYPOINT ["/usr/bin/datakit"]
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.bridge-local-git
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN opam update --dev && opam upgrade
RUN opam install datakit-bridge-local-git -tyv
RUN sudo cp $(opam config exec -- which datakit-bridge-local-git) /usr/bin/

FROM alpine:3.8
FROM alpine:3.9
RUN apk add --no-cache libev gmp tzdata ca-certificates
ENTRYPOINT ["/usr/bin/datakit-bridge-local-git"]
COPY --from=0 /usr/bin/datakit-bridge-local-git /usr/bin/datakit-bridge-local-git
2 changes: 1 addition & 1 deletion Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ RUN sudo apk add --no-cache tzdata aspcud gmp-dev perl libev-dev m4
ENV OPAMERRLOGLEN=0 OPAMYES=1

RUN git -C /home/opam/opam-repository fetch origin && \
git -C /home/opam/opam-repository reset da99aec5e0ecc83bd86926b620eff45b99c82c26 --hard && \
git -C /home/opam/opam-repository reset b01a2e4e1ac2fb545d593ad40bc95b4a78dec9e2 --hard && \
opam update -u

RUN opam install alcotest lwt conf-libev inotify
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.client
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ RUN sudo apk add --no-cache tzdata aspcud gmp-dev perl libev-dev m4
ENV OPAMERRLOGLEN=0 OPAMYES=1

RUN git -C /home/opam/opam-repository fetch origin && \
git -C /home/opam/opam-repository reset da99aec5e0ecc83bd86926b620eff45b99c82c26 --hard && \
git -C /home/opam/opam-repository reset b01a2e4e1ac2fb545d593ad40bc95b4a78dec9e2 --hard && \
opam update -u

RUN opam install alcotest lwt conf-libev inotify
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.github
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ RUN sudo apk add --no-cache tzdata aspcud gmp-dev perl libev-dev m4
ENV OPAMERRLOGLEN=0 OPAMYES=1

RUN git -C /home/opam/opam-repository fetch origin && \
git -C /home/opam/opam-repository reset da99aec5e0ecc83bd86926b620eff45b99c82c26 --hard && \
git -C /home/opam/opam-repository reset b01a2e4e1ac2fb545d593ad40bc95b4a78dec9e2 --hard && \
opam update -u

RUN opam install alcotest lwt conf-libev inotify tls
Expand Down Expand Up @@ -32,7 +32,7 @@ RUN opam install datakit-bridge-github -ytv

RUN sudo cp $(opam config exec -- which datakit-bridge-github) /usr/bin/

FROM alpine:3.8
FROM alpine:3.9
RUN apk add --no-cache libev gmp tzdata ca-certificates
EXPOSE 5640
EXPOSE 5641
Expand Down
2 changes: 1 addition & 1 deletion ci/src/cI_output.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let logs = snd
let status t = CI_result.status (result t)
let descr t = CI_result.descr (result t)

let rec json_of_logs : logs -> Yojson.Basic.json = function
let rec json_of_logs : logs -> Yojson.Basic.t = function
| Empty -> `Null
| Live x ->
`Assoc [
Expand Down
4 changes: 2 additions & 2 deletions ci/src/cI_output.mli
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ val equal : string t -> string t -> bool
(** [equal a b] is [true] iff [a] and [b] are equal for the purposes of saving the output metadata to disk.
i.e. they have the same JSON representation. *)

val json_of : string t -> Yojson.Basic.json
val of_json : Yojson.Basic.json -> string t
val json_of : string t -> Yojson.Basic.t
val of_json : Yojson.Basic.t -> string t

val pp : 'a Fmt.t -> 'a t Fmt.t
4 changes: 2 additions & 2 deletions ci/src/cI_result.mli
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ val pp: 'a Fmt.t -> 'a t Fmt.t
val v : [< `Success | `Pending | `Failure] -> string -> string t
val status : _ t -> [> `Success | `Pending | `Failure]
val descr : string t -> string
val json_of : string t -> Yojson.Basic.json
val of_json : Yojson.Basic.json -> string t
val json_of : string t -> Yojson.Basic.t
val of_json : Yojson.Basic.t -> string t
1 change: 0 additions & 1 deletion ci/src/cI_static.mli
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ val read : string -> string option

(* to avoid warning 32 *)
val file_list: string list
val size: string -> int64 option
4 changes: 2 additions & 2 deletions ci/src/cI_web_utils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ module Auth = struct
if Sys.file_exists passwd_file then (
load_local_users passwd_file >|= fun db -> `Configured db
) else (
let token = B64.(encode ~alphabet:uri_safe_alphabet) (Nocrypto.Rng.generate 24 |> Cstruct.to_string) in
let token = Base64.(encode_string ~alphabet:uri_safe_alphabet) (Nocrypto.Rng.generate 24 |> Cstruct.to_string) in
let setup_url = Uri.with_path web_ui ("/auth/intro/" ^ token) in
Log.app (fun f -> f ">>> Configure the CI by visiting@\n%a" Uri.pp_hum setup_url);
Lwt.return (`Config_token token)
Expand Down Expand Up @@ -444,7 +444,7 @@ class virtual resource_with_session t =
method private session rd =
let generate_new_session () =
Log.info (fun f -> f "Generating new session");
let csrf_token = B64.encode (Nocrypto.Rng.generate 16 |> Cstruct.to_string) in
let csrf_token = Base64.encode_string (Nocrypto.Rng.generate 16 |> Cstruct.to_string) in
let value = { Session_data.csrf_token; username = None; login_redirect = None; attrs = Auth.empty_attrs } in
self#session_set (Session_data.to_string value) rd >>= fun () ->
Lwt.return value
Expand Down
2 changes: 1 addition & 1 deletion ci/tests/test_utils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ let strip_times log =
Str.global_replace re_timestamp "" log

module Json = struct
type t = Yojson.Basic.json
type t = Yojson.Basic.t
let pp f v = Yojson.Basic.pretty_print f v
let equal = (=)
end
Expand Down
2 changes: 2 additions & 0 deletions datakit-ci.opam
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ depends: [
"irmin-unix" {with-test & >= "1.2.0"}
"alcotest" {with-test}
"cohttp-lwt-unix" {>= "1.0.0"}
"base64" {>="3.1.0"}
"yojson" {>="1.7.0"}
]
build: [
["dune" "build" "-p" name "-j" jobs]
Expand Down