Skip to content

Commit

Permalink
[ci skip][skip ci][skip netlify] -bors-staging-tmp-201
Browse files Browse the repository at this point in the history
  • Loading branch information
bors-ng-on-prem[bot] committed Jan 19, 2022
2 parents cfa3c79 + c6c0ce3 commit 88d5d63
Show file tree
Hide file tree
Showing 16 changed files with 128 additions and 46 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/release_artifacts.yml
@@ -0,0 +1,25 @@
name: "Release Artifacts"
on:
push:
branches:
- master
- 'release/**'

jobs:
kubectl-plugin:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.4.0
- uses: cachix/install-nix-action@v15
with:
nix_path: nixpkgs=channel:nixos
- run: nix-build -A utils.release.linux-musl.kubectl-plugin
- uses: actions/upload-artifact@v2
with:
name: kubectl-mayastor
path: ./result/bin/kubectl-mayastor
- run: nix-build -A utils.release.windows-gnu.kubectl-plugin
- uses: actions/upload-artifact@v2
with:
name: kubectl-mayastor.exe
path: ./result/bin/kubectl-mayastor.exe
22 changes: 12 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "common-lib"
version = "0.1.0"
version = "1.0.0"
authors = ["paul <paul.yoong@mayadata.io>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion control-plane/agents/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "agents"
version = "0.1.0"
version = "1.0.0"
authors = ["Tiago Castro <tiago.castro@mayadata.io>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion control-plane/csi-controller/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "csi-controller"
version = "0.1.0"
version = "1.0.0"
authors = ["Mikhail Tcymbaliuk <m.tcymbaliuk@mayadata.io>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion control-plane/msp-operator/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "msp-operator"
version = "0.1.0"
version = "1.0.0"
edition = "2018"
authors = ["Jeffry Molanus <jeffry.molanus@gmail.com>"]

Expand Down
2 changes: 1 addition & 1 deletion control-plane/rest/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rest"
version = "0.1.0"
version = "1.0.0"
authors = ["Tiago Castro <tiago.castro@mayadata.io>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion deployer/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "deployer"
version = "0.1.0"
version = "1.0.0"
authors = ["Tiago Castro <tiago.castro@mayadata.io>"]
edition = "2018"

Expand Down
9 changes: 7 additions & 2 deletions kubectl-plugin/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "kubectl-plugin"
version = "0.1.0"
version = "1.0.0"
edition = "2018"

[[bin]]
Expand All @@ -9,8 +9,13 @@ path = "src/main.rs"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
default = [ "rls" ]
rls = [ "openapi/tower-client-rls" ]
tls = [ "openapi/tower-client-tls" ]

[dependencies]
openapi = { path = "../openapi", default-features = false, features = [ "tower-client", "tower-trace" ] }
openapi = { path = "../openapi", default-features = false, features = [ "tower-trace" ] }
tokio = { version = "1.12.0" }
anyhow = "1.0.44"
async-trait = "0.1.51"
Expand Down
3 changes: 3 additions & 0 deletions kubectl-plugin/src/main.rs
Expand Up @@ -152,7 +152,10 @@ fn url_from_kubeconfig() -> Result<Url> {
Ok(file_path) => Some(file_path),
Err(_) => {
// Look for kubeconfig file in default location.
#[cfg(target_os = "linux")]
let default_path = format!("{}/.kube/config", env::var("HOME")?);
#[cfg(target_os = "windows")]
let default_path = format!("{}/.kube/config", env::var("USERPROFILE")?);
match Path::new(&default_path).exists() {
true => Some(default_path),
false => None,
Expand Down
3 changes: 3 additions & 0 deletions nix/lib/rust.nix
Expand Up @@ -15,4 +15,7 @@ rec {
override = { extensions = [ "rust-src" ]; };
};
static = rust_default { override = { targets = [ "${static_target}" ]; }; };
windows_cross = rust_default {
override = { targets = [ "${pkgs.rust.toRustTargetSpec pkgs.pkgsCross.mingwW64.hostPlatform}" ]; };
};
}
4 changes: 2 additions & 2 deletions nix/pkgs/openapi-generator/source.json
@@ -1,6 +1,6 @@
{
"owner": "openebs",
"repo": "openapi-generator",
"rev": "7b945ec6801c6dee28cfff269e86b79be0fe1b71",
"sha256": "1hss1cd5a4l76zphjikg78hq5askyqd8h8y1x4524pf75igs6l8w"
"rev": "d60a2fcb4d3cde7b17dd5d1aa96f821d7720b2cb",
"sha256": "1x0j3k7alzrgp6yyhjnr9gkzf8m9mlsi4vc4f3xv5ig0w8dzd5dh"
}
75 changes: 56 additions & 19 deletions nix/pkgs/utils/default.nix
Expand Up @@ -16,6 +16,7 @@ let
"Cargo.lock"
"Cargo.toml"
"common"
"composer"
"control-plane"
"deployer"
"kubectl-plugin"
Expand All @@ -25,28 +26,64 @@ let
"scripts"
];

naersk = pkgs.callPackage sources.naersk {
rustc = channel.static.stable;
cargo = channel.static.stable;
naersk_package = channel: pkgs.callPackage sources.naersk {
rustc = channel.stable;
cargo = channel.stable;
};
naersk = naersk_package channel.static;
naersk_cross = naersk_package channel.windows_cross;

components = { release ? false }: {
kubectl-plugin = naersk.buildPackage {
inherit release src;
preBuild = ''
# don't run during the dependency build phase
if [ ! -f build.rs ]; then
patchShebangs ./scripts/rust/generate-openapi-bindings.sh
./scripts/rust/generate-openapi-bindings.sh
fi
sed -i '/ctrlp-tests.*=/d' ./kubectl-plugin/Cargo.toml
'';
cargoBuildOptions = attrs: attrs ++ [ "-p" "kubectl-plugin" ];
CARGO_BUILD_TARGET = "x86_64-unknown-linux-musl";
CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static";
nativeBuildInputs = [ clang openapi-generator which git ];
doCheck = false;
usePureFromTOML = true;
windows-gnu = {
kubectl-plugin = naersk_cross.buildPackage {
inherit release src version;
name = "kubectl-plugin";

preBuild = ''
# don't run during the dependency build phase
if [ ! -f build.rs ]; then
patchShebangs ./scripts/generate-openapi-bindings.sh
./scripts/generate-openapi-bindings.sh
fi
sed -i '/ctrlp-tests.*=/d' ./kubectl-plugin/Cargo.toml
export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUSTFLAGS="-C link-args=''$(echo $NIX_LDFLAGS | tr ' ' '\n' | grep -- '^-L' | tr '\n' ' ')"
export NIX_LDFLAGS=
'';
cargoBuildOptions = attrs: attrs ++ [ "-p" "kubectl-plugin" "--no-default-features" "--features" "tls" ];
buildInputs = with pkgs.pkgsCross.mingwW64.windows; [ mingw_w64_pthreads pthreads ];
nativeBuildInputs = [ pkgs.pkgsCross.mingwW64.clangStdenv.cc openapi-generator which git ];
doCheck = false;
usePureFromTOML = true;

CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static";
CARGO_BUILD_TARGET = "x86_64-pc-windows-gnu";
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER = with pkgs.pkgsCross.mingwW64.clangStdenv;
"${cc}/bin/${cc.targetPrefix}cc";
};
recurseForDerivations = true;
};
linux-musl = {
kubectl-plugin = naersk.buildPackage {
inherit release src version;
name = "kubectl-plugin";

preBuild = ''
# don't run during the dependency build phase
if [ ! -f build.rs ]; then
patchShebangs ./scripts/generate-openapi-bindings.sh
./scripts/generate-openapi-bindings.sh
fi
sed -i '/ctrlp-tests.*=/d' ./kubectl-plugin/Cargo.toml
'';
cargoBuildOptions = attrs: attrs ++ [ "-p" "kubectl-plugin" ];
nativeBuildInputs = [ clang openapi-generator which git ];
doCheck = false;
usePureFromTOML = true;

CARGO_BUILD_TARGET = "x86_64-unknown-linux-musl";
CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static";
};
recurseForDerivations = true;
};
};
in
Expand Down
17 changes: 12 additions & 5 deletions openapi/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "openapi"
version = "0.2.0"
version = "1.0.0"
authors = ["OpenAPI Generator team and contributors"]
edition = "2018"

Expand All @@ -14,12 +14,16 @@ path = "./examples/clients/tower/main.rs"
required-features = [ "tower-client", "tower-trace" ]

[features]
default = [ "actix-server" ]
default = [ "tower-client-rls", "tower-trace" ]
actix-server = [ "actix" ]
actix-client = [ "actix", "awc" ]
actix = [ "actix-web", "actix-web-opentelemetry", "rustls" ]
tower-client-rls = [ "tower-client", "rustls_feat" ]
tower-client-tls = [ "tower-client", "hyper_tls_feat" ]
tower-client = [ "tower-hyper" ]
tower-hyper = [ "hyper", "tower", "tower-http", "bytes", "http-body", "futures", "pin-project", "hyper-rustls", "tokio", "rustls", "webpki" ]
tower-hyper = [ "hyper", "tower", "tower-http", "bytes", "http-body", "futures", "pin-project", "tokio" ]
hyper_tls_feat = [ "hyper-tls", "tokio-native-tls" ]
rustls_feat = [ "rustls", "webpki", "hyper-rustls" ]
tower-trace = [ "opentelemetry-jaeger", "tracing-opentelemetry", "opentelemetry", "opentelemetry-http", "tracing", "tracing-subscriber", "opentelemetry-semantic-conventions" ]

[dependencies]
Expand All @@ -36,7 +40,6 @@ serde_urlencoded = "0.7"
actix-web = { version = "4.0.0-beta.19", features = ["rustls"], optional = true }
actix-web-opentelemetry = { version = "0.11.0-beta.7", optional = true }
awc = { version = "3.0.0-beta.18", optional = true }
rustls = { version = "0.19.1", optional = true, features = [ "dangerous_configuration" ] }

# tower and hyper dependencies
hyper = { version = "0.14.13", features = [ "client", "http1", "http2", "tcp", "stream" ], optional = true }
Expand All @@ -47,8 +50,12 @@ tokio = { version = "1.12.0", features = ["full"], optional = true }
http-body = { version = "0.4.3", optional = true }
futures = { version = "0.3.17", optional = true }
pin-project = { version = "1.0.8", optional = true }
hyper-rustls = { version = "0.22.1", optional = true }
# SSL
rustls = { version = "0.19.1", optional = true, features = [ "dangerous_configuration" ] }
webpki = { version = "0.21.4", optional = true }
hyper-rustls = { version = "0.22.1", optional = true }
hyper-tls = { version = "0.5.0", optional = true }
tokio-native-tls = { version = "0.3.0", optional = true }
# tracing and telemetry
opentelemetry-jaeger = { version = "0.15.0", features = ["rt-tokio-current-thread"], optional = true }
tracing-opentelemetry = { version = "0.15.0", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion rpc/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rpc"
version = "0.1.0"
version = "1.0.0"
authors = ["Jeffry Molanus <jeffry.molanus@gmail.com>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion tests/tests-mayastor/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ctrlp-tests"
version = "0.1.0"
version = "1.0.0"
authors = ["Tiago Castro <tiago.castro@mayadata.io>"]
edition = "2018"
description = "Control Plane 'Compose' Tests"
Expand Down

0 comments on commit 88d5d63

Please sign in to comment.