Skip to content

Commit

Permalink
Merge gitcloner into fleetcli
Browse files Browse the repository at this point in the history
TODO
* move source to internal?
  • Loading branch information
manno committed Apr 25, 2024
1 parent e9b8fde commit 7b28415
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 45 deletions.
1 change: 0 additions & 1 deletion .github/scripts/build-fleet-binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ go build -gcflags='all=-N -l' -o "bin/fleet-linux-$GOARCH" ./cmd/fleetcli
go build -gcflags='all=-N -l' -o "bin/fleetagent-linux-$GOARCH" ./cmd/fleetagent

# gitjob
go build -gcflags='all=-N -l' -o "bin/gitcloner-linux-$GOARCH" ./cmd/gitcloner
go build -gcflags='all=-N -l' -o "bin/gitjob-linux-$GOARCH" ./cmd/gitjob
20 changes: 0 additions & 20 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ archives:
builds:
- fleet-agent

- id: fleet-gitcloner
format: binary
name_template: "{{ .Binary }}"
builds:
- fleet-gitcloner

- id: fleet-gitjob
format: binary
name_template: "{{ .Binary }}"
Expand Down Expand Up @@ -66,18 +60,6 @@ builds:
- linux_amd64_v1
- linux_arm64
- windows_amd64
-
id: fleet-gitcloner
main: ./cmd/gitcloner
binary: gitcloner-{{ .Os }}-{{ .Arch }}{{ if .Arm }}64{{ end }}
no_unique_dist_dir: true
ldflags:
- -w -s
- -X github.com/rancher/fleet/pkg/version.GitCommit={{ .Commit }}
- -X github.com/rancher/fleet/pkg/version.Version={{ .Tag }}
targets:
- linux_amd64_v1
- linux_arm64
-
id: fleet-gitjob
main: ./cmd/gitjob
Expand Down Expand Up @@ -130,7 +112,6 @@ dockers:
ids:
- fleet-controller
- fleet-cli
- fleet-gitcloner
- fleet-gitjob

# Templates of the Docker image names.
Expand Down Expand Up @@ -159,7 +140,6 @@ dockers:
ids:
- fleet-controller
- fleet-cli
- fleet-gitcloner
- fleet-gitjob
image_templates:
- "docker.io/rancher/fleet:{{ .Tag }}-linux-arm64"
Expand Down
18 changes: 0 additions & 18 deletions cmd/gitcloner/main.go

This file was deleted.

1 change: 0 additions & 1 deletion dev/build-fleet
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ fi

export GOOS=linux
# gitjob
go build -gcflags='all=-N -l' -o "bin/gitcloner-linux-$GOARCH" ./cmd/gitcloner
go build -gcflags='all=-N -l' -o "bin/gitjob-linux-$GOARCH" ./cmd/gitjob

# fleet
Expand Down
3 changes: 3 additions & 0 deletions internal/cmd/cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ package cli
import (
"github.com/spf13/cobra"

gitcmd "github.com/rancher/fleet/cmd/gitcloner/cmd"
"github.com/rancher/fleet/cmd/gitcloner/gogit"
"github.com/rancher/fleet/internal/client"
command "github.com/rancher/fleet/internal/cmd"
"github.com/rancher/fleet/pkg/version"
Expand Down Expand Up @@ -32,6 +34,7 @@ func App() *cobra.Command {

NewTarget(),
NewDeploy(),
gitcmd.New(gogit.NewCloner()),
)

return root
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/gitjob/gitjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ func volumesFromSecret(
}

func (r *GitJobReconciler) generateInitContainer(ctx context.Context, obj *v1alpha1.GitRepo) (corev1.Container, error) {
args := []string{obj.Spec.Repo, "/workspace"}
args := []string{"gitcloner", obj.Spec.Repo, "/workspace"}
volumeMounts := []corev1.VolumeMount{
{
Name: gitClonerVolumeName,
Expand Down Expand Up @@ -673,7 +673,7 @@ func (r *GitJobReconciler) generateInitContainer(ctx context.Context, obj *v1alp

return corev1.Container{
Command: []string{
"gitcloner",
"fleet",
},
Args: args,
Image: r.Image,
Expand Down
3 changes: 0 additions & 3 deletions package/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,18 @@ ONBUILD ARG ARCH
ONBUILD COPY bin/fleetcontroller-linux-$ARCH /usr/bin/fleetcontroller
ONBUILD COPY bin/fleet-linux-$ARCH /usr/bin/fleet
ONBUILD COPY bin/gitjob-linux-$ARCH /usr/bin/gitjob
ONBUILD COPY bin/gitcloner-linux-$ARCH /usr/bin/gitcloner

FROM base AS copy_buildx
ONBUILD ARG TARGETARCH
ONBUILD COPY bin/fleetcontroller-linux-$TARGETARCH /usr/bin/fleetcontroller
ONBUILD COPY bin/fleet-linux-$TARGETARCH /usr/bin/fleet
ONBUILD COPY bin/gitjob-linux-$TARGETARCH /usr/bin/gitjob
ONBUILD COPY bin/gitcloner-linux-$TARGETARCH /usr/bin/gitcloner

FROM base AS copy_goreleaser
ONBUILD ARG ARCH
ONBUILD COPY fleetcontroller-linux-$ARCH /usr/bin/fleetcontroller
ONBUILD COPY fleet-linux-$ARCH /usr/bin/fleet
ONBUILD COPY gitjob-linux-$ARCH /usr/bin/gitjob
ONBUILD COPY gitcloner-linux-$ARCH /usr/bin/gitcloner

FROM copy_${BUILD_ENV}
USER 1000
Expand Down

0 comments on commit 7b28415

Please sign in to comment.