Skip to content

Commit

Permalink
Cleanup workflow actions and update devbox dependencies (#475)
Browse files Browse the repository at this point in the history
* Cleanup workflow actions and update devbox dependencies

- Use devbox install action instead of manually installing devbox
- Update cache action to v4
- Update codecov action to v4
- Remove unnecessary nix flakes
- Simplify the coverage output by removing unnecessary tools as codecov
  now understands coverage.out

* Bump all devbox dependencies to latest

regenerate all mocks with newer mockgen

* Update manifests

Run `make manifests`
  • Loading branch information
thunderboltsid authored Aug 16, 2024
1 parent 973b197 commit 285483f
Show file tree
Hide file tree
Showing 24 changed files with 1,006 additions and 620 deletions.
24 changes: 9 additions & 15 deletions .github/workflows/build-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ jobs:
with:
ref: "${{ github.event.pull_request.head.sha }}"

- uses: actions/cache@v3
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.11.0
with:
enable-cache: "true"

- uses: actions/cache@v4
with:
path: |
~/.cache/golangci-lint
Expand All @@ -26,12 +31,6 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
- name: Install devbox
run: curl -fsSL https://get.jetpack.io/devbox | bash -s -- -f

- name: Install devbox deps
run: devbox install

- name: Verify that generated manifests committed to the repository are up to date
run: devbox run -- make verify-manifests

Expand All @@ -52,20 +51,15 @@ jobs:
- name: Run unit tests
run: devbox run -- make unit-test

# gocov-xml expects things to be properly placed under go path.
# GHA clones into /home/runner/work/repository so we create
# the directory under the right path and link it
- run: mkdir -p /home/runner/go/src/github.com/nutanix-cloud-native/ && ln -s /home/runner/work/cluster-api-provider-nutanix/cluster-api-provider-nutanix /home/runner/go/src/github.com/nutanix-cloud-native

- name: Run coverage report
run: devbox run -- "make coverage"
run: devbox run -- make coverage

- name: Codecov
uses: codecov/codecov-action@v3.1.4
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
file: ./coverage.xml # Replace with the path to your coverage report
file: ./coverage.out # Replace with the path to your coverage report
fail_ci_if_error: true

- name: Run Trivy vulnerability scanner
Expand Down
11 changes: 2 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -325,18 +325,11 @@ GOTESTPKGS = $(shell go list ./... | grep -v /mocks | grep -v /templates)

.PHONY: unit-test
unit-test: mocks ## Run unit tests.
ifeq ($(EXPORT_RESULT), true)
$(eval OUTPUT_OPTIONS = | go-junit-report -set-exit-code > junit-report.xml)
endif
KUBEBUILDER_ASSETS="$(shell setup-envtest use $(ENVTEST_K8S_VERSION) --arch=amd64 -p path)" $(GOTEST) $(GOTESTPKGS) $(OUTPUT_OPTIONS)
KUBEBUILDER_ASSETS="$(shell setup-envtest use $(ENVTEST_K8S_VERSION) --arch=amd64 -p path)" $(GOTEST) $(GOTESTPKGS)

.PHONY: coverage
coverage: mocks ## Run the tests of the project and export the coverage
KUBEBUILDER_ASSETS="$(shell setup-envtest use $(ENVTEST_K8S_VERSION) --arch=amd64 -p path)" $(GOTEST) -cover -covermode=count -coverprofile=profile.cov $(GOTESTPKGS)
$(GOTOOL) cover -func profile.cov
ifeq ($(EXPORT_RESULT), true)
gocov convert profile.cov | gocov-xml > coverage.xml
endif
KUBEBUILDER_ASSETS="$(shell setup-envtest use $(ENVTEST_K8S_VERSION) --arch=amd64 -p path)" $(GOTEST) -race -coverprofile=coverage.out -covermode=atomic $(GOTESTPKGS)

.PHONY: template-test
template-test: docker-build prepare-local-clusterctl ## Run the template tests
Expand Down
124 changes: 63 additions & 61 deletions config/crd/bases/infrastructure.cluster.x-k8s.io_nutanixclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.13.0
controller-gen.kubebuilder.io/version: v0.14.0
name: nutanixclusters.infrastructure.cluster.x-k8s.io
spec:
group: infrastructure.cluster.x-k8s.io
Expand Down Expand Up @@ -33,24 +33,29 @@ spec:
description: NutanixCluster is the Schema for the nutanixclusters API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: NutanixClusterSpec defines the desired state of NutanixCluster
properties:
controlPlaneEndpoint:
description: ControlPlaneEndpoint represents the endpoint used to
communicate with the control plane. host can be either DNS name
or ip address
description: |-
ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
host can be either DNS name or ip address
properties:
host:
description: The hostname on which the API server is serving.
Expand All @@ -64,20 +69,19 @@ spec:
- port
type: object
failureDomains:
description: failureDomains configures failure domains information
for the Nutanix platform. When set, the failure domains defined
here may be used to spread Machines across prism element clusters
to improve fault tolerance of the cluster.
description: |-
failureDomains configures failure domains information for the Nutanix platform.
When set, the failure domains defined here may be used to spread Machines across
prism element clusters to improve fault tolerance of the cluster.
items:
description: NutanixFailureDomain configures failure domain information
for Nutanix.
properties:
cluster:
description: cluster is to identify the cluster (the Prism Element
under management of the Prism Central), in which the Machine's
VM will be created. The cluster identifier (uuid or name)
can be obtained from the Prism Central console or using the
prism_central API.
description: |-
cluster is to identify the cluster (the Prism Element under management of the Prism Central),
in which the Machine's VM will be created. The cluster identifier (uuid or name) can be obtained
from the Prism Central console or using the prism_central API.
properties:
name:
description: name is the resource name in the PC
Expand All @@ -100,22 +104,21 @@ spec:
plane nodes
type: boolean
name:
description: name defines the unique name of a failure domain.
description: |-
name defines the unique name of a failure domain.
Name is required and must be at most 64 characters in length.
It must consist of only lower case alphanumeric characters
and hyphens (-). It must start and end with an alphanumeric
character. This value is arbitrary and is used to identify
the failure domain within the platform.
It must consist of only lower case alphanumeric characters and hyphens (-).
It must start and end with an alphanumeric character.
This value is arbitrary and is used to identify the failure domain within the platform.
maxLength: 64
minLength: 1
pattern: '[a-z0-9]([-a-z0-9]*[a-z0-9])?'
type: string
subnets:
description: subnets holds a list of identifiers (one or more)
of the cluster's network subnets for the Machine's VM to connect
to. The subnet identifiers (uuid or name) can be obtained
from the Prism Central console or using the prism_central
API.
description: |-
subnets holds a list of identifiers (one or more) of the cluster's network subnets
for the Machine's VM to connect to. The subnet identifiers (uuid or name) can be
obtained from the Prism Central console or using the prism_central API.
items:
description: NutanixResourceIdentifier holds the identity
of a Nutanix PC resource (cluster, image, subnet, etc.)
Expand Down Expand Up @@ -148,18 +151,17 @@ spec:
- name
x-kubernetes-list-type: map
prismCentral:
description: prismCentral holds the endpoint address and port to access
the Nutanix Prism Central. When a cluster-wide proxy is installed,
by default, this endpoint will be accessed via the proxy. Should
you wish for communication with this endpoint not to be proxied,
please add the endpoint to the proxy spec.noProxy list.
description: |-
prismCentral holds the endpoint address and port to access the Nutanix Prism Central.
When a cluster-wide proxy is installed, by default, this endpoint will be accessed via the proxy.
Should you wish for communication with this endpoint not to be proxied, please add the endpoint to the
proxy spec.noProxy list.
properties:
additionalTrustBundle:
description: AdditionalTrustBundle is a PEM encoded x509 cert
for the RootCA that was used to create the certificate for a
Prism Central that uses certificates that were issued by a non-publicly
trusted RootCA. The trust bundle is added to the cert pool used
to authenticate the TLS connection to the Prism Central.
description: |-
AdditionalTrustBundle is a PEM encoded x509 cert for the RootCA that was used to create the certificate
for a Prism Central that uses certificates that were issued by a non-publicly trusted RootCA. The trust
bundle is added to the cert pool used to authenticate the TLS connection to the Prism Central.
properties:
data:
description: Data of the trust bundle if Kind is String.
Expand Down Expand Up @@ -231,37 +233,37 @@ spec:
operational state.
properties:
lastTransitionTime:
description: 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 the API field
changed is acceptable.
description: |-
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
the API field changed is acceptable.
format: date-time
type: string
message:
description: A human readable message indicating details about
the transition. This field may be empty.
description: |-
A human readable message indicating details about the transition.
This field may be empty.
type: string
reason:
description: The reason for the condition's last transition
in CamelCase. The specific API may choose whether or not this
field is considered a guaranteed API. This field may not be
empty.
description: |-
The reason for the condition's last transition in CamelCase.
The specific API may choose whether or not this field is considered a guaranteed API.
This field may not be empty.
type: string
severity:
description: Severity provides an explicit classification of
Reason code, so the users or machines can immediately understand
the current situation and act accordingly. The Severity field
MUST be set only when Status=False.
description: |-
Severity provides an explicit classification of Reason code, so the users or machines can immediately
understand the current situation and act accordingly.
The Severity field MUST be set only when Status=False.
type: string
status:
description: Status of the condition, one of True, False, Unknown.
type: string
type:
description: Type of condition in CamelCase or in foo.example.com/CamelCase.
Many .condition.type values are consistent across resources
like Available, but because arbitrary conditions can be useful
(see .node.status.conditions), the ability to deconflict is
important.
description: |-
Type of condition in CamelCase or in foo.example.com/CamelCase.
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions
can be useful (see .node.status.conditions), the ability to deconflict is important.
type: string
required:
- lastTransitionTime
Expand All @@ -271,9 +273,9 @@ spec:
type: array
failureDomains:
additionalProperties:
description: FailureDomainSpec is the Schema for Cluster API failure
domains. It allows controllers to understand how many failure
domains a cluster can optionally span across.
description: |-
FailureDomainSpec is the Schema for Cluster API failure domains.
It allows controllers to understand how many failure domains a cluster can optionally span across.
properties:
attributes:
additionalProperties:
Expand Down
Loading

0 comments on commit 285483f

Please sign in to comment.