Skip to content

Commit

Permalink
improve pipeline
Browse files Browse the repository at this point in the history
test script should not fail the pipeline immediately but still cause the pipeline to fail if there is at least one failing feature.

Signed-off-by: Sebastian Hoß <[email protected]>
  • Loading branch information
sebhoss committed Feb 17, 2024
1 parent 3740168 commit 31e7cbc
Show file tree
Hide file tree
Showing 54 changed files with 116 additions and 150 deletions.
1 change: 1 addition & 0 deletions .github/workflows/update-crds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
- name: Fix changed CRDs
run: |
for feature in $(git diff --name-only origin/main -- ./kube-custom-resources-rs/src | grep --invert-match lib.rs | xargs --no-run-if-empty -I{} dirname {} | sort --unique | xargs --no-run-if-empty -I{} dirname {} | xargs --no-run-if-empty -I{} basename {}); do
echo "trying to fix ${feature}"
if [ -f "./kube-custom-resources-rs/src/${feature}/mod.rs" ]; then
./code-generator/fix-cargo-warnings.sh "${feature}"
fi
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,18 @@ jobs:
run: cargo check --package code-generator --locked
- name: Check changed CRDs
run: |
all_good=yes
for feature in $(git diff --name-only origin/main -- ./kube-custom-resources-rs/src | grep --invert-match lib.rs | xargs --no-run-if-empty -I{} dirname {} | sort --unique | xargs --no-run-if-empty -I{} dirname {} | xargs --no-run-if-empty -I{} basename {}); do
echo "trying to test ${feature}"
if [ -f "./kube-custom-resources-rs/src/${feature}/mod.rs" ]; then
./code-generator/test-custom-resources.sh "${feature}"
if ! ./code-generator/test-custom-resources.sh "${feature}"; then
all_good=no
fi
fi
done
if [ "${all_good}" == no ]; then
echo 'we encountered test failures'
exit 1
fi
env:
RUSTFLAGS: "--deny warnings"
7 changes: 6 additions & 1 deletion code-generator/test-custom-resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,10 @@ for feature in $(cargo read-manifest --manifest-path ./kube-custom-resources-rs/
fi

echo "testing ${feature}"
cargo check --lib --package kube-custom-resources-rs --features "${feature}" --locked
if cargo check --lib --package kube-custom-resources-rs --features "${feature}" --locked; then
echo "${feature} succeeded"
else
echo "${feature} failed"
# exit 1
fi
done
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--derive=PartialEq
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--derive=PartialEq
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--derive=PartialEq
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--derive=PartialEq
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--derive=PartialEq
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cannot find type `ClusterResourceSetBindingStatus` in this scope
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--derive=PartialEq
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cannot find type `ClusterResourceSetBindingStatus` in this scope
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cannot find type `ClusterResourceSetBindingStatus` in this scope

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// WARNING: generated by kopium - manual changes will be overwritten
// kopium command: kopium --docs --filename=./crd-catalog/kubernetes-sigs/cluster-api/addons.cluster.x-k8s.io/v1alpha3/clusterresourcesets.yaml --derive=Default --derive=PartialEq
// kopium command: kopium --docs --filename=./crd-catalog/kubernetes-sigs/cluster-api/addons.cluster.x-k8s.io/v1alpha3/clusterresourcesets.yaml --derive=PartialEq
// kopium version: 0.16.5

use kube::CustomResource;
use serde::{Serialize, Deserialize};
use std::collections::BTreeMap;

/// ClusterResourceSetSpec defines the desired state of ClusterResourceSet.
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, PartialEq)]
#[kube(group = "addons.cluster.x-k8s.io", version = "v1alpha3", kind = "ClusterResourceSet", plural = "clusterresourcesets")]
#[kube(namespaced)]
#[kube(status = "ClusterResourceSetStatus")]
Expand All @@ -29,7 +29,7 @@ pub struct ClusterResourceSetSpec {
/// Label selector for Clusters. The Clusters that are
/// selected by this will be the ones affected by this ClusterResourceSet.
/// It must match the Cluster labels. This field is immutable.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct ClusterResourceSetClusterSelector {
/// matchExpressions is a list of label selector requirements. The requirements are ANDed.
#[serde(default, skip_serializing_if = "Option::is_none", rename = "matchExpressions")]
Expand All @@ -43,7 +43,7 @@ pub struct ClusterResourceSetClusterSelector {

/// A label selector requirement is a selector that contains values, a key, and an operator that
/// relates the key and values.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct ClusterResourceSetClusterSelectorMatchExpressions {
/// key is the label key that the selector applies to.
pub key: String,
Expand All @@ -59,7 +59,7 @@ pub struct ClusterResourceSetClusterSelectorMatchExpressions {
}

/// ResourceRef specifies a resource.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct ClusterResourceSetResources {
/// Kind of the resource. Supported kinds are: Secrets and ConfigMaps.
pub kind: ClusterResourceSetResourcesKind,
Expand All @@ -81,7 +81,7 @@ pub enum ClusterResourceSetStrategy {
}

/// ClusterResourceSetStatus defines the observed state of ClusterResourceSet.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct ClusterResourceSetStatus {
/// Conditions defines current state of the ClusterResourceSet.
#[serde(default, skip_serializing_if = "Option::is_none")]
Expand All @@ -92,7 +92,7 @@ pub struct ClusterResourceSetStatus {
}

/// Condition defines an observation of a Cluster API resource operational state.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct ClusterResourceSetStatusConditions {
/// Last time the condition transitioned from one status to another.
/// This should be when the underlying condition changed. If that is not known, then using the time when
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
pub mod clusterresourcesetbindings;
pub mod clusterresourcesets;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// kopium command: kopium --docs --filename=./crd-catalog/aws/aws-application-networking-k8s/application-networking.k8s.aws/v1alpha1/serviceexports.yaml --derive=PartialEq
// kopium version: 0.16.5

use kube::CustomResource;

use serde::{Serialize, Deserialize};

/// status describes the current state of an exported service. Service configuration comes from the Service that had the same name and namespace as this ServiceExport. Populated by the multi-cluster service implementation's controller.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// kopium command: kopium --docs --filename=./crd-catalog/redhat-developer/service-binding-operator/binding.operators.coreos.com/v1alpha1/bindablekinds.yaml --derive=Default --derive=PartialEq
// kopium version: 0.16.5

use kube::CustomResource;

use serde::{Serialize, Deserialize};

/// BindableKindsStatus defines the observed state of BindableKinds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// kopium command: kopium --docs --filename=./crd-catalog/volcano-sh/volcano/bus.volcano.sh/v1alpha1/commands.yaml --derive=Default --derive=PartialEq
// kopium version: 0.16.5

use kube::CustomResource;

use serde::{Serialize, Deserialize};

/// TargetObject defines the target object of this command.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// kopium command: kopium --docs --filename=./crd-catalog/grafana/loki/config.grafana.com/v1/projectconfigs.yaml --derive=Default --derive=PartialEq
// kopium version: 0.16.5

use kube::CustomResource;

use serde::{Serialize, Deserialize};
use std::collections::BTreeMap;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// kopium command: kopium --docs --filename=./crd-catalog/karmada-io/karmada/config.karmada.io/v1alpha1/resourceinterpreterwebhookconfigurations.yaml --derive=Default --derive=PartialEq
// kopium version: 0.16.5

use kube::CustomResource;

use serde::{Serialize, Deserialize};

/// ResourceInterpreterWebhook describes the webhook as well as the resources and operations it applies to.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// kopium command: kopium --docs --filename=./crd-catalog/kubewharf/kubeadmiral/core.kubeadmiral.io/v1alpha1/clustercollectedstatuses.yaml --derive=Default --derive=PartialEq
// kopium version: 0.16.5

use kube::CustomResource;

use serde::{Serialize, Deserialize};
use std::collections::HashMap;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// kopium command: kopium --docs --filename=./crd-catalog/kubewharf/kubeadmiral/core.kubeadmiral.io/v1alpha1/clusterpropagatedversions.yaml --derive=Default --derive=PartialEq
// kopium version: 0.16.5

use kube::CustomResource;

use serde::{Serialize, Deserialize};

/// PropagatedVersionStatus defines the observed state of PropagatedVersion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// kopium command: kopium --docs --filename=./crd-catalog/kubewharf/kubeadmiral/core.kubeadmiral.io/v1alpha1/collectedstatuses.yaml --derive=Default --derive=PartialEq
// kopium version: 0.16.5

use kube::CustomResource;

use serde::{Serialize, Deserialize};
use std::collections::HashMap;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// kopium command: kopium --docs --filename=./crd-catalog/kubewharf/kubeadmiral/core.kubeadmiral.io/v1alpha1/propagatedversions.yaml --derive=Default --derive=PartialEq
// kopium version: 0.16.5

use kube::CustomResource;

use serde::{Serialize, Deserialize};

/// PropagatedVersionStatus defines the observed state of PropagatedVersion
Expand Down
Loading

0 comments on commit 31e7cbc

Please sign in to comment.