Skip to content

Commit 948f425

Browse files
committed
rm initcommand
1 parent 954335f commit 948f425

1 file changed

Lines changed: 7 additions & 13 deletions

File tree

internal/initplugins/gitplugin/gitplugin.go

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@ import (
99
)
1010

1111
type gitPlugin struct {
12-
Repourl string `required:"true" json:"repourl"`
13-
Branch string `json:"branch"`
14-
VolumeName string `required:"true" json:"volumeName"`
15-
Image string `required:"true" json:"image"`
16-
InitCommand string `json:"initCommand"`
12+
Repourl string `required:"true" json:"repourl"`
13+
Branch string `json:"branch"`
14+
VolumeName string `required:"true" json:"volumeName"`
1715
}
1816

1917
func New(params map[string]string) (common.PluginInterface, error) {
@@ -34,22 +32,18 @@ func New(params map[string]string) (common.PluginInterface, error) {
3432
}
3533

3634
func (g *gitPlugin) GenerateInitContainerApplyConfiguration() *corev1apply.ContainerApplyConfiguration {
37-
initCommand := fmt.Sprintf("cd /persistent/work && %v", g.InitCommand)
38-
39-
command := fmt.Sprintf(`
35+
command := `
4036
if [ ! -d /persistent/work ]; then
4137
mkdir -p /persistent/work;
42-
sudo apt install -y git;
43-
git clone -b `+g.Branch+` `+g.Repourl+` /persistent/work;
44-
%v
38+
git clone -b ` + g.Branch + ` ` + g.Repourl + ` /persistent/work;
4539
else
4640
echo 'work directory already exists';
4741
fi
48-
`, initCommand)
42+
`
4943

5044
initcontainer := corev1apply.Container().
5145
WithName("git").
52-
WithImage(g.Image).
46+
WithImage("alpine/git").
5347
WithCommand("sh", "-c", command).
5448
WithVolumeMounts(corev1apply.VolumeMount().
5549
WithName(g.VolumeName).

0 commit comments

Comments
 (0)