Skip to content

Commit

Permalink
breaking change: unify disk-virt task code and rename their parameters
Browse files Browse the repository at this point in the history
The disk-virt tasks have almost identical code. This
commit keeps only single version of disk-virt code.
The params of the tasks were unified and renamed:
customizeCommands, sysprepCommands -> virtCommands
additionalOptions -> additionalVirtOptions

Signed-off-by: Karel Simon <[email protected]>
  • Loading branch information
ksimon1 committed Jul 11, 2024
1 parent ecd856a commit adcddc7
Show file tree
Hide file tree
Showing 44 changed files with 168 additions and 563 deletions.
13 changes: 7 additions & 6 deletions cmd/disk-virt-customize/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package main

import (
goarg "github.com/alexflint/go-arg"
. "github.com/kubevirt/kubevirt-tekton-tasks/modules/disk-virt-customize/pkg/constants"
"github.com/kubevirt/kubevirt-tekton-tasks/modules/disk-virt-customize/pkg/execute"
"github.com/kubevirt/kubevirt-tekton-tasks/modules/disk-virt-customize/pkg/utils/log"
"github.com/kubevirt/kubevirt-tekton-tasks/modules/disk-virt-customize/pkg/utils/parse"
"github.com/kubevirt/kubevirt-tekton-tasks/modules/shared/pkg/exit"
"go.uber.org/zap"

. "github.com/kubevirt/kubevirt-tekton-tasks/modules/disk-virt/pkg/constants"
"github.com/kubevirt/kubevirt-tekton-tasks/modules/disk-virt/pkg/execute"
"github.com/kubevirt/kubevirt-tekton-tasks/modules/disk-virt/pkg/utils/log"
"github.com/kubevirt/kubevirt-tekton-tasks/modules/disk-virt/pkg/utils/parse"
"github.com/kubevirt/kubevirt-tekton-tasks/modules/shared/pkg/exit"
)

func main() {
Expand All @@ -23,7 +24,7 @@ func main() {
if err := cliOptions.Init(); err != nil {
exit.ExitOrDieFromError(InvalidArguments, err)
}
executor := execute.NewExecutor(cliOptions, DiskImagePath)
executor := execute.NewExecutor(cliOptions, DiskImagePath, "virt-customize")

if err := executor.PrepareGuestFSAppliance(); err != nil {
exit.ExitOrDieFromError(PrepareGuestFSApplianceFailed, err)
Expand Down
13 changes: 7 additions & 6 deletions cmd/disk-virt-sysprep/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package main

import (
goarg "github.com/alexflint/go-arg"
. "github.com/kubevirt/kubevirt-tekton-tasks/modules/disk-virt-sysprep/pkg/constants"
"github.com/kubevirt/kubevirt-tekton-tasks/modules/disk-virt-sysprep/pkg/execute"
"github.com/kubevirt/kubevirt-tekton-tasks/modules/disk-virt-sysprep/pkg/utils/log"
"github.com/kubevirt/kubevirt-tekton-tasks/modules/disk-virt-sysprep/pkg/utils/parse"
"github.com/kubevirt/kubevirt-tekton-tasks/modules/shared/pkg/exit"
"go.uber.org/zap"

. "github.com/kubevirt/kubevirt-tekton-tasks/modules/disk-virt/pkg/constants"
"github.com/kubevirt/kubevirt-tekton-tasks/modules/disk-virt/pkg/execute"
"github.com/kubevirt/kubevirt-tekton-tasks/modules/disk-virt/pkg/utils/log"
"github.com/kubevirt/kubevirt-tekton-tasks/modules/disk-virt/pkg/utils/parse"
"github.com/kubevirt/kubevirt-tekton-tasks/modules/shared/pkg/exit"
)

func main() {
Expand All @@ -23,7 +24,7 @@ func main() {
if err := cliOptions.Init(); err != nil {
exit.ExitOrDieFromError(InvalidArguments, err)
}
executor := execute.NewExecutor(cliOptions, DiskImagePath)
executor := execute.NewExecutor(cliOptions, DiskImagePath, "virt-sysprep")

if err := executor.PrepareGuestFSAppliance(); err != nil {
exit.ExitOrDieFromError(PrepareGuestFSApplianceFailed, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ spec:
params:
- name: pvc
value: "$(tasks.modify-data-object.results.name)"
- name: customizeCommands
- name: virtCommands
value: |
install git,vim,pip
run-command pip install flask
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ spec:
params:
- name: pvc
value: "$(tasks.modify-data-object.results.name)"
- name: sysprepCommands
- name: virtCommands
value: |
run-command yum update -y
- name: additionalOptions
- name: additionalVirtOptions
value: "--network"
taskRef:
kind: Task
Expand Down
17 changes: 0 additions & 17 deletions modules/disk-virt-customize/pkg/constants/constants.go

This file was deleted.

17 changes: 0 additions & 17 deletions modules/disk-virt-customize/pkg/execute/execute_suite_test.go

This file was deleted.

89 changes: 0 additions & 89 deletions modules/disk-virt-customize/pkg/execute/executor.go

This file was deleted.

18 changes: 0 additions & 18 deletions modules/disk-virt-customize/pkg/execute/virt-customize-opts.go

This file was deleted.

This file was deleted.

20 changes: 0 additions & 20 deletions modules/disk-virt-customize/pkg/utils/log/log_test.go

This file was deleted.

44 changes: 0 additions & 44 deletions modules/disk-virt-customize/pkg/utils/parse/clioptions.go

This file was deleted.

52 changes: 0 additions & 52 deletions modules/disk-virt-customize/pkg/utils/parse/clioptions_test.go

This file was deleted.

Loading

0 comments on commit adcddc7

Please sign in to comment.