From 95dbf6e8c482bdc6b9d42a67db0bdeec83b01da0 Mon Sep 17 00:00:00 2001 From: Nikita Korolev Date: Fri, 24 Apr 2026 19:07:43 +0300 Subject: [PATCH] save phaseage Signed-off-by: Nikita Korolev --- .github/workflows/dev_build_precache.yml | 1 + .github/workflows/dev_build_svace.yml | 2 ++ .../dev_module_build-and-registration.yml | 2 ++ .github/workflows/dev_module_build.yml | 2 ++ .../release_module_build-and-registration.yml | 5 ++++ .../release_module_release-channels.yml | 6 ++++ .werf/consts.yaml | 1 + .werf/images.yaml | 1 + api/core/v1alpha2/virtual_machine.go | 1 - crds/doc-ru-virtualmachines.yaml | 8 ----- .../doc-ru-virtualmachines-dev-phaseage.yaml | 9 ++++++ .../patches/virtualmachines-dev-phaseage.yaml | 30 +++++++++++++++++++ crds/virtualmachines.yaml | 28 ----------------- .../vm/internal/phase_transitions_dev.go | 26 ++++++++++++++++ .../vm/internal/phase_transitions_dev_test.go | 30 +++++++++++++++++++ .../vm/internal/phase_transitions_prod.go | 9 ++++++ .../internal/phase_transitions_prod_test.go | 21 +++++++++++++ .../pkg/controller/vm/internal/statistic.go | 14 --------- images/virtualization-artifact/werf.inc.yaml | 8 +++-- werf-giterminism.yaml | 1 + werf.yaml | 17 +++++++++++ 21 files changed, 169 insertions(+), 53 deletions(-) create mode 100644 crds/patches/doc-ru-virtualmachines-dev-phaseage.yaml create mode 100644 crds/patches/virtualmachines-dev-phaseage.yaml create mode 100644 images/virtualization-artifact/pkg/controller/vm/internal/phase_transitions_dev.go create mode 100644 images/virtualization-artifact/pkg/controller/vm/internal/phase_transitions_dev_test.go create mode 100644 images/virtualization-artifact/pkg/controller/vm/internal/phase_transitions_prod.go create mode 100644 images/virtualization-artifact/pkg/controller/vm/internal/phase_transitions_prod_test.go diff --git a/.github/workflows/dev_build_precache.yml b/.github/workflows/dev_build_precache.yml index a8116437fc..2e3a80c775 100644 --- a/.github/workflows/dev_build_precache.yml +++ b/.github/workflows/dev_build_precache.yml @@ -20,6 +20,7 @@ env: MODULES_MODULE_SOURCE: ${{ vars.DEV_MODULE_SOURCE }} MODULES_REGISTRY_LOGIN: ${{ vars.DEV_MODULES_REGISTRY_LOGIN }} MODULES_REGISTRY_PASSWORD: ${{ secrets.DEV_MODULES_REGISTRY_PASSWORD }} + MODULE_BUILD_PROFILE: "dev" SOURCE_REPO: "${{secrets.SOURCE_REPO}}" SOURCE_REPO_GIT: "${{secrets.SOURCE_REPO_GIT}}" diff --git a/.github/workflows/dev_build_svace.yml b/.github/workflows/dev_build_svace.yml index eaf7f44e1b..06701dd191 100644 --- a/.github/workflows/dev_build_svace.yml +++ b/.github/workflows/dev_build_svace.yml @@ -20,6 +20,7 @@ env: MODULES_MODULE_SOURCE: ${{ vars.DEV_MODULE_SOURCE }} MODULES_REGISTRY_LOGIN: ${{ vars.DEV_MODULES_REGISTRY_LOGIN }} MODULES_REGISTRY_PASSWORD: ${{ secrets.DEV_MODULES_REGISTRY_PASSWORD }} + MODULE_BUILD_PROFILE: "dev" SOURCE_REPO: "${{secrets.SOURCE_REPO}}" SOURCE_REPO_GIT: "${{secrets.SOURCE_REPO_GIT}}" @@ -92,6 +93,7 @@ jobs: echo MODULES_MODULE_NAME=$MODULES_MODULE_NAME echo MODULES_MODULE_SOURCE=$MODULES_MODULE_SOURCE echo MODULE_EDITION=$MODULE_EDITION + echo MODULE_BUILD_PROFILE=$MODULE_BUILD_PROFILE echo MODULES_MODULE_TAG=$MODULES_MODULE_TAG echo DOCKER_CONFIG=$DOCKER_CONFIG diff --git a/.github/workflows/dev_module_build-and-registration.yml b/.github/workflows/dev_module_build-and-registration.yml index c4963bc4da..2f861084b0 100644 --- a/.github/workflows/dev_module_build-and-registration.yml +++ b/.github/workflows/dev_module_build-and-registration.yml @@ -21,6 +21,7 @@ env: MODULES_MODULE_SOURCE: ${{ vars.DEV_MODULE_SOURCE }} MODULES_REGISTRY_LOGIN: ${{ vars.DEV_MODULES_REGISTRY_LOGIN }} MODULES_REGISTRY_PASSWORD: ${{ secrets.DEV_MODULES_REGISTRY_PASSWORD }} + MODULE_BUILD_PROFILE: "dev" RELEASE_CHANNEL: ${{ github.event.inputs.channel }} MODULES_MODULE_TAG: ${{ github.event.inputs.tag }} SOURCE_REPO: "${{secrets.SOURCE_REPO}}" @@ -72,6 +73,7 @@ jobs: echo MODULES_MODULE_NAME=$MODULES_MODULE_NAME echo RELEASE_CHANNEL=$RELEASE_CHANNEL echo MODULE_EDITION=$MODULE_EDITION + echo MODULE_BUILD_PROFILE=$MODULE_BUILD_PROFILE echo DOCKER_CONFIG=$DOCKER_CONFIG shell: bash - name: Validation and set MODULES_MODULE_TAG diff --git a/.github/workflows/dev_module_build.yml b/.github/workflows/dev_module_build.yml index e4638b4024..3fad5ba9a9 100644 --- a/.github/workflows/dev_module_build.yml +++ b/.github/workflows/dev_module_build.yml @@ -21,6 +21,7 @@ env: MODULES_MODULE_SOURCE: ${{ vars.DEV_MODULE_SOURCE }} MODULES_REGISTRY_LOGIN: ${{ vars.DEV_MODULES_REGISTRY_LOGIN }} MODULES_REGISTRY_PASSWORD: ${{ secrets.DEV_MODULES_REGISTRY_PASSWORD }} + MODULE_BUILD_PROFILE: "dev" GO_VERSION: "1.25.9" GOLANGCI_LINT_VERSION: "2.11.1" SOURCE_REPO: "${{secrets.SOURCE_REPO}}" @@ -346,6 +347,7 @@ jobs: echo MODULES_MODULE_SOURCE=$MODULES_MODULE_SOURCE echo MODULES_MODULE_TAG=$MODULES_MODULE_TAG echo MODULE_EDITION=$MODULE_EDITION + echo MODULE_BUILD_PROFILE=$MODULE_BUILD_PROFILE echo DEBUG_COMPONENT=$DEBUG_COMPONENT echo DOCKER_CONFIG=$DOCKER_CONFIG diff --git a/.github/workflows/release_module_build-and-registration.yml b/.github/workflows/release_module_build-and-registration.yml index 81f0492266..fff3f5ccae 100644 --- a/.github/workflows/release_module_build-and-registration.yml +++ b/.github/workflows/release_module_build-and-registration.yml @@ -21,6 +21,7 @@ env: MODULE_SOURCE_NAME: ${{ vars.PROD_MODULE_SOURCE_NAME }} MODULES_REGISTRY_LOGIN: ${{ vars.PROD_MODULES_REGISTRY_LOGIN }} MODULES_REGISTRY_PASSWORD: ${{ secrets.PROD_MODULES_REGISTRY_PASSWORD }} + MODULE_BUILD_PROFILE: "release" MODULES_MODULE_TAG: ${{ github.ref_name }} SOURCE_REPO: "${{ secrets.SOURCE_REPO }}" SOURCE_REPO_GIT: "${{secrets.SOURCE_REPO_GIT}}" @@ -60,6 +61,7 @@ jobs: echo $MODULES_MODULE_NAME echo $MODULES_MODULE_SOURCE echo $MODULES_MODULE_TAG + echo $MODULE_BUILD_PROFILE shell: bash name: Show vars @@ -113,6 +115,7 @@ jobs: echo $MODULES_MODULE_NAME echo $MODULES_MODULE_SOURCE echo $MODULES_MODULE_TAG + echo $MODULE_BUILD_PROFILE shell: bash name: Show vars @@ -167,6 +170,7 @@ jobs: echo $MODULES_MODULE_NAME echo $MODULES_MODULE_SOURCE echo $MODULES_MODULE_TAG + echo $MODULE_BUILD_PROFILE shell: bash name: Show vars @@ -221,6 +225,7 @@ jobs: echo $MODULES_MODULE_NAME echo $MODULES_MODULE_SOURCE echo $MODULES_MODULE_TAG + echo $MODULE_BUILD_PROFILE shell: bash name: Show vars diff --git a/.github/workflows/release_module_release-channels.yml b/.github/workflows/release_module_release-channels.yml index aa30bed9e9..423171d92c 100644 --- a/.github/workflows/release_module_release-channels.yml +++ b/.github/workflows/release_module_release-channels.yml @@ -22,6 +22,7 @@ env: RELEASE_CHANNEL: ${{ github.event.inputs.channel }} MODULES_REGISTRY_LOGIN: ${{ vars.PROD_MODULES_REGISTRY_LOGIN }} MODULES_REGISTRY_PASSWORD: ${{ secrets.PROD_MODULES_REGISTRY_PASSWORD }} + MODULE_BUILD_PROFILE: "release" MODULES_MODULE_TAG: ${{ github.event.inputs.tag }} SOURCE_REPO: ${{ secrets.SOURCE_REPO }} SOURCE_REPO_GIT: ${{secrets.SOURCE_REPO_GIT}} @@ -93,6 +94,7 @@ jobs: echo MODULES_MODULE_NAME=$MODULES_MODULE_NAME echo RELEASE_CHANNEL=$RELEASE_CHANNEL echo MODULE_EDITION=$MODULE_EDITION + echo MODULE_BUILD_PROFILE=$MODULE_BUILD_PROFILE echo DOCKER_CONFIG=$DOCKER_CONFIG shell: bash @@ -180,6 +182,7 @@ jobs: - name: ECHO VAR run: | echo $MODULES_MODULE_SOURCE + echo $MODULE_BUILD_PROFILE - uses: actions/checkout@v4 with: fetch-depth: 0 @@ -240,6 +243,7 @@ jobs: - name: ECHO VAR run: | echo $MODULES_MODULE_SOURCE + echo $MODULE_BUILD_PROFILE - uses: actions/checkout@v4 with: fetch-depth: 0 @@ -305,6 +309,7 @@ jobs: - name: ECHO VAR run: | echo $MODULES_MODULE_SOURCE + echo $MODULE_BUILD_PROFILE - uses: actions/checkout@v4 with: fetch-depth: 0 @@ -364,6 +369,7 @@ jobs: - name: ECHO VAR run: | echo $MODULES_MODULE_SOURCE + echo $MODULE_BUILD_PROFILE - name: Validation for tag run: | echo ${{ github.event.inputs.tag }} | grep -P '^v\d+\.\d+\.\d+' diff --git a/.werf/consts.yaml b/.werf/consts.yaml index 9ca41dec0e..361ac7c06b 100644 --- a/.werf/consts.yaml +++ b/.werf/consts.yaml @@ -1,5 +1,6 @@ # Edition module settings {{- $_ := set . "MODULE_EDITION" (env "MODULE_EDITION" "EE") }} +{{- $_ := set . "MODULE_BUILD_PROFILE" (env "MODULE_BUILD_PROFILE" "release") }} # Component versions {{- $_ := set . "Firmware" dict -}} diff --git a/.werf/images.yaml b/.werf/images.yaml index d0850ad3c9..702da38af7 100644 --- a/.werf/images.yaml +++ b/.werf/images.yaml @@ -31,6 +31,7 @@ dockerfile: Dockerfile {{- $_ := set $ctx "SOURCE_REPO" $Root.SOURCE_REPO }} {{- $_ := set $ctx "SOURCE_REPO_GIT" $Root.SOURCE_REPO_GIT }} {{- $_ := set $ctx "MODULE_EDITION" $Root.MODULE_EDITION }} +{{- $_ := set $ctx "MODULE_BUILD_PROFILE" $Root.MODULE_BUILD_PROFILE }} {{- $_ := set $ctx "DEBUG_COMPONENT" $Root.DEBUG_COMPONENT }} {{- $_ := set $ctx "Firmware" $Root.Firmware }} {{- $_ := set $ctx "Package" $Root.Package }} diff --git a/api/core/v1alpha2/virtual_machine.go b/api/core/v1alpha2/virtual_machine.go index 5633a02610..62ba4393aa 100644 --- a/api/core/v1alpha2/virtual_machine.go +++ b/api/core/v1alpha2/virtual_machine.go @@ -41,7 +41,6 @@ const ( // +kubebuilder:subresource:status // +kubebuilder:resource:categories={all,virtualization},scope=Namespaced,shortName={vm},singular=virtualmachine // +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="The phase of the virtual machine." -// +kubebuilder:printcolumn:name="PhaseAge",type="date",JSONPath=".status.stats.phasesTransitions[-1].timestamp",description="Time since the virtual machine entered the current phase." // +kubebuilder:printcolumn:name="Cores",priority=1,type="string",JSONPath=".spec.cpu.cores",description="The number of cores of the virtual machine." // +kubebuilder:printcolumn:name="CoreFraction",priority=1,type="string",JSONPath=".spec.cpu.coreFraction",description="Virtual machine core fraction. The range of available values is set in the `sizePolicy` parameter of the VirtualMachineClass; if it is not set, use values within the 1–100% range." // +kubebuilder:printcolumn:name="Memory",priority=1,type="string",JSONPath=".spec.memory.size",description="The amount of memory of the virtual machine." diff --git a/crds/doc-ru-virtualmachines.yaml b/crds/doc-ru-virtualmachines.yaml index 9998fc1112..51f2960931 100644 --- a/crds/doc-ru-virtualmachines.yaml +++ b/crds/doc-ru-virtualmachines.yaml @@ -687,14 +687,6 @@ spec: stats: description: Статистика по виртуальной машине. properties: - phasesTransitions: - description: История по фазам. - items: - properties: - phase: - description: Фаза виртуальной машины. - timestamp: - description: Время перехода в данную фазу. launchTimeDuration: description: Информация о запуске. properties: diff --git a/crds/patches/doc-ru-virtualmachines-dev-phaseage.yaml b/crds/patches/doc-ru-virtualmachines-dev-phaseage.yaml new file mode 100644 index 0000000000..4e33fb9240 --- /dev/null +++ b/crds/patches/doc-ru-virtualmachines-dev-phaseage.yaml @@ -0,0 +1,9 @@ +statsProperties: + phasesTransitions: + description: История по фазам. + items: + properties: + phase: + description: Фаза виртуальной машины. + timestamp: + description: Время перехода в данную фазу. diff --git a/crds/patches/virtualmachines-dev-phaseage.yaml b/crds/patches/virtualmachines-dev-phaseage.yaml new file mode 100644 index 0000000000..f8fbfebcd6 --- /dev/null +++ b/crds/patches/virtualmachines-dev-phaseage.yaml @@ -0,0 +1,30 @@ +phaseAgeColumn: + description: Time since the virtual machine entered the current phase. + jsonPath: .status.stats.phasesTransitions[-1].timestamp + name: PhaseAge + type: date +statsProperties: + phasesTransitions: + description: Phase history. + type: array + items: + type: object + properties: + phase: + description: Virtual machine phase. + type: string + enum: + - "Pending" + - "Running" + - "Degraded" + - "Terminating" + - "Stopped" + - "Stopping" + - "Starting" + - "Migrating" + - "Pause" + timestamp: + description: Time of transition to this phase. + format: date-time + nullable: true + type: string diff --git a/crds/virtualmachines.yaml b/crds/virtualmachines.yaml index 88162c552b..6ae259ac7f 100644 --- a/crds/virtualmachines.yaml +++ b/crds/virtualmachines.yaml @@ -1157,30 +1157,6 @@ spec: type: object description: Virtual machine statistics. properties: - phasesTransitions: - description: Phase history. - type: array - items: - type: object - properties: - phase: - description: Virtual machine phase. - type: string - enum: - - "Pending" - - "Running" - - "Degraded" - - "Terminating" - - "Stopped" - - "Stopping" - - "Starting" - - "Migrating" - - "Pause" - timestamp: - description: Time of transition to this phase. - format: date-time - nullable: true - type: string launchTimeDuration: description: Details on the launch. type: object @@ -1422,10 +1398,6 @@ spec: jsonPath: .status.phase name: Phase type: string - - description: Time since the virtual machine entered the current phase. - jsonPath: .status.stats.phasesTransitions[-1].timestamp - name: PhaseAge - type: date - description: Real number of the virtual machine cores. jsonPath: .status.resources.cpu.cores name: Cores diff --git a/images/virtualization-artifact/pkg/controller/vm/internal/phase_transitions_dev.go b/images/virtualization-artifact/pkg/controller/vm/internal/phase_transitions_dev.go new file mode 100644 index 0000000000..179b6e632d --- /dev/null +++ b/images/virtualization-artifact/pkg/controller/vm/internal/phase_transitions_dev.go @@ -0,0 +1,26 @@ +//go:build dev + +package internal + +import ( + "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/deckhouse/virtualization/api/core/v1alpha2" +) + +func NewPhaseTransitions(phaseTransitions []v1alpha2.VirtualMachinePhaseTransitionTimestamp, oldPhase, newPhase v1alpha2.MachinePhase) []v1alpha2.VirtualMachinePhaseTransitionTimestamp { + now := metav1.NewTime(time.Now().Truncate(time.Second)) + + if oldPhase != newPhase { + phaseTransitions = append(phaseTransitions, v1alpha2.VirtualMachinePhaseTransitionTimestamp{ + Phase: newPhase, + Timestamp: now, + }) + } + if len(phaseTransitions) > 5 { + return phaseTransitions[len(phaseTransitions)-5:] + } + return phaseTransitions +} diff --git a/images/virtualization-artifact/pkg/controller/vm/internal/phase_transitions_dev_test.go b/images/virtualization-artifact/pkg/controller/vm/internal/phase_transitions_dev_test.go new file mode 100644 index 0000000000..ac62785cf6 --- /dev/null +++ b/images/virtualization-artifact/pkg/controller/vm/internal/phase_transitions_dev_test.go @@ -0,0 +1,30 @@ +//go:build dev + +package internal + +import ( + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/deckhouse/virtualization/api/core/v1alpha2" +) + +var _ = Describe("Phase transitions in dev build", func() { + It("appends and keeps the latest five transitions", func() { + transitions := []v1alpha2.VirtualMachinePhaseTransitionTimestamp{ + {Phase: v1alpha2.MachinePending, Timestamp: metav1.Now()}, + {Phase: v1alpha2.MachineStarting, Timestamp: metav1.Now()}, + {Phase: v1alpha2.MachineRunning, Timestamp: metav1.Now()}, + {Phase: v1alpha2.MachineStopping, Timestamp: metav1.Now()}, + {Phase: v1alpha2.MachineStopped, Timestamp: metav1.Now()}, + } + + updated := NewPhaseTransitions(transitions, v1alpha2.MachineStopped, v1alpha2.MachinePending) + + Expect(updated).To(HaveLen(5)) + Expect(updated[0].Phase).To(Equal(v1alpha2.MachineStarting)) + Expect(updated[4].Phase).To(Equal(v1alpha2.MachinePending)) + Expect(updated[4].Timestamp.IsZero()).To(BeFalse()) + }) +}) diff --git a/images/virtualization-artifact/pkg/controller/vm/internal/phase_transitions_prod.go b/images/virtualization-artifact/pkg/controller/vm/internal/phase_transitions_prod.go new file mode 100644 index 0000000000..aefc160d6e --- /dev/null +++ b/images/virtualization-artifact/pkg/controller/vm/internal/phase_transitions_prod.go @@ -0,0 +1,9 @@ +//go:build !dev + +package internal + +import "github.com/deckhouse/virtualization/api/core/v1alpha2" + +func NewPhaseTransitions([]v1alpha2.VirtualMachinePhaseTransitionTimestamp, v1alpha2.MachinePhase, v1alpha2.MachinePhase) []v1alpha2.VirtualMachinePhaseTransitionTimestamp { + return nil +} diff --git a/images/virtualization-artifact/pkg/controller/vm/internal/phase_transitions_prod_test.go b/images/virtualization-artifact/pkg/controller/vm/internal/phase_transitions_prod_test.go new file mode 100644 index 0000000000..b8a582543e --- /dev/null +++ b/images/virtualization-artifact/pkg/controller/vm/internal/phase_transitions_prod_test.go @@ -0,0 +1,21 @@ +//go:build !dev + +package internal + +import ( + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/deckhouse/virtualization/api/core/v1alpha2" +) + +var _ = Describe("Phase transitions in release build", func() { + It("drops transition history", func() { + transitions := []v1alpha2.VirtualMachinePhaseTransitionTimestamp{ + {Phase: v1alpha2.MachinePending, Timestamp: metav1.Now()}, + } + + Expect(NewPhaseTransitions(transitions, v1alpha2.MachinePending, v1alpha2.MachineRunning)).To(BeNil()) + }) +}) diff --git a/images/virtualization-artifact/pkg/controller/vm/internal/statistic.go b/images/virtualization-artifact/pkg/controller/vm/internal/statistic.go index e77a10209e..1263026363 100644 --- a/images/virtualization-artifact/pkg/controller/vm/internal/statistic.go +++ b/images/virtualization-artifact/pkg/controller/vm/internal/statistic.go @@ -374,17 +374,3 @@ func osInfoIsEmpty(info virtv1.VirtualMachineInstanceGuestOSInfo) bool { return emptyOSInfo == info } -func NewPhaseTransitions(phaseTransitions []v1alpha2.VirtualMachinePhaseTransitionTimestamp, oldPhase, newPhase v1alpha2.MachinePhase) []v1alpha2.VirtualMachinePhaseTransitionTimestamp { - now := metav1.NewTime(time.Now().Truncate(time.Second)) - - if oldPhase != newPhase { - phaseTransitions = append(phaseTransitions, v1alpha2.VirtualMachinePhaseTransitionTimestamp{ - Phase: newPhase, - Timestamp: now, - }) - } - if len(phaseTransitions) > 5 { - return phaseTransitions[len(phaseTransitions)-5:] - } - return phaseTransitions -} diff --git a/images/virtualization-artifact/werf.inc.yaml b/images/virtualization-artifact/werf.inc.yaml index fc6f1448c3..7cbebdec40 100644 --- a/images/virtualization-artifact/werf.inc.yaml +++ b/images/virtualization-artifact/werf.inc.yaml @@ -49,11 +49,15 @@ shell: - | echo "Build virtualization-controller binary" {{- $_ := set $ "ProjectName" (list $.ImageName "virtualization-controller" | join "/") }} + {{- $controllerBuildTags := .MODULE_EDITION -}} + {{- if eq .MODULE_BUILD_PROFILE "dev" -}} + {{- $controllerBuildTags = printf "%s,dev" .MODULE_EDITION -}} + {{- end }} {{- if eq $.DEBUG_COMPONENT "delve/virtualization-controller" }} - go build -tags {{ .MODULE_EDITION }} -v -a -o /out/virtualization-controller ./cmd/virtualization-controller + go build -tags {{ $controllerBuildTags }} -v -a -o /out/virtualization-controller ./cmd/virtualization-controller {{- else }} - {{- $buildCommand := printf "go build -ldflags=\"-s -w\" -tags %s -v -a -o /out/virtualization-controller ./cmd/virtualization-controller" .MODULE_EDITION -}} + {{- $buildCommand := printf "go build -ldflags=\"-s -w\" -tags %s -v -a -o /out/virtualization-controller ./cmd/virtualization-controller" $controllerBuildTags -}} {{- include "image-build.build" (set $ "BuildCommand" $buildCommand) | nindent 4 }} {{- end }} diff --git a/werf-giterminism.yaml b/werf-giterminism.yaml index a91cf7efc7..66af535e7e 100644 --- a/werf-giterminism.yaml +++ b/werf-giterminism.yaml @@ -8,6 +8,7 @@ config: - SOURCE_REPO - SOURCE_REPO_GIT - MODULE_EDITION + - MODULE_BUILD_PROFILE - DISTRO_PACKAGES_PROXY - SVACE_ENABLED - SVACE_ANALYZE_HOST diff --git a/werf.yaml b/werf.yaml index 0d0e8f2a3a..60ddf6d868 100644 --- a/werf.yaml +++ b/werf.yaml @@ -124,8 +124,25 @@ git: - templates/virtualization-dra {{- end }} shell: + beforeInstall: + - apk add --no-cache yq install: - ls -la /prep-bundle + - | + if [ "{{ .MODULE_BUILD_PROFILE }}" = "dev" ]; then + yq eval -i ' + .spec.versions[] |= ( + .additionalPrinterColumns += [load("/prep-bundle/crds/patches/virtualmachines-dev-phaseage.yaml").phaseAgeColumn] | + .schema.openAPIV3Schema.properties.status.properties.stats.properties += load("/prep-bundle/crds/patches/virtualmachines-dev-phaseage.yaml").statsProperties + ) + ' /prep-bundle/crds/virtualmachines.yaml + + yq eval -i ' + .spec.versions[] |= ( + .schema.openAPIV3Schema.properties.status.properties.stats.properties += load("/prep-bundle/crds/patches/doc-ru-virtualmachines-dev-phaseage.yaml").statsProperties + ) + ' /prep-bundle/crds/doc-ru-virtualmachines.yaml + fi --- image: release-channel-version fromImage: builder/scratch