Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

created build-dev dagger function for enhance developer workflow #169

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Althaf66
Copy link
Collaborator

This fixes #163

  • Added build-dev dagger function to build the Harbor binary for development purposes.

  • Updated existing Dagger functions with descriptions.

Screenshot from 2024-08-16 11-42-41

main.go Outdated Show resolved Hide resolved
main.go Outdated
Comment on lines 86 to 98
// Return a container that build the Harbor binary for development purposes.
func (m *HarborCli) BuildDev(ctx context.Context, directoryArg *dagger.Directory) *dagger.Container {
fmt.Println("🛠️ Building Harbor binary with Dagger...")

// Define the path for the binary output
binaryOutputPath := "/src/bin/harbor"
return dag.Container().
From("golang:latest").
WithMountedDirectory("/src", directoryArg).
WithWorkdir("/src/cmd/harbor").
WithExec([]string{"go", "build", "-o", binaryOutputPath, "main.go"}).
WithWorkdir("/src")
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Update build-dev to produce binary out of the box without any args or flags such as directory.
  • dagger call build-dev should work.

Screenshot_2024-08-16_18-37-51

main.go Outdated Show resolved Hide resolved
@bupd
Copy link
Collaborator

bupd commented Aug 16, 2024

@Althaf66 Additionally, build-dev should actually be able to build harbor based on their system. So devs on windows and Linux can use it.

Copy link
Collaborator

@bupd bupd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run your code with go fmt ./...

main.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@bupd bupd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update the README with the command to build the binary using harbor.

cmd: dagger call build-dev --source=. --goos=$(go env GOOS) --goarch=$(go env GOARCH) export --path=bin

Dagger call does not support Host access & Host environment.

main.go Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance Developer Workflow with Dagger
2 participants