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

Revamping building and release with dagger multibuild pipeline #25

Closed
wants to merge 50 commits into from

Conversation

bishal7679
Copy link
Contributor

@bishal7679 bishal7679 commented Feb 23, 2024

Fixing #22

Previous State

  • Previously, building Makefile based
  • releasing with dagger pipeline missing

Current Behavior

  • Added building file as go code with dagger build.go
  • Automated the release with dagger CI by calling for release and pull_request event separately [added deb rpm package based binary release with architecture]
  • Added Software Bill of Materials (SBOM) generation during release for each archive by analyzing the various generated artifacts using Syft
  • Added brew install support
    • We need to create a separate repo under goharbor named homebrew-tap for uploading the tap formula which will eventually be used during brew installation

Screenshot

24-02-2024:00:08:01

PS:- should be removed go.work & go.work.sum file after using the release pipeline once!
//cc @Vad1mo

Signed-off-by: bishal7679 <bishalhnj127@gmail.com>
Signed-off-by: bishal7679 <bishalhnj127@gmail.com>
@Vad1mo
Copy link
Member

Vad1mo commented Feb 23, 2024

Awesome!

I'll looking forward to try this out!

Signed-off-by: bishal7679 <bishalhnj127@gmail.com>
@bishal7679
Copy link
Contributor Author

Hello @Vad1mo @OrlinVasilev
PTAL in this PR!

@OrlinVasilev OrlinVasilev self-assigned this Feb 26, 2024
bishal7679 and others added 2 commits February 27, 2024 22:22
Signed-off-by: bishal7679 <bishalhnj127@gmail.com>
Signed-off-by: Bishal Das  <70086051+bishal7679@users.noreply.github.com>
@bishal7679
Copy link
Contributor Author

@Vad1mo could you pls take a look on it. Now with dagger CI it's also adding release binary to multiple pkg manager and its workflow files running successfully!

Signed-off-by: Bishal Das  <70086051+bishal7679@users.noreply.github.com>
@Vad1mo
Copy link
Member

Vad1mo commented Apr 24, 2024

build go is building not the harbor cli but rather the build.go file

Something lke this:
build = build.WithExec([]string{"go", "build", "-o", path, "/src/cmd/harbor/main.go"})

@Vad1mo
Copy link
Member

Vad1mo commented Apr 24, 2024

can you also provide instrustion on how to test ideally locally the release and pull-request flow?

Signed-off-by: bishal7679 <bishalhnj127@gmail.com>
bishal7679 and others added 4 commits April 27, 2024 12:01
Signed-off-by: Bishal Das  <70086051+bishal7679@users.noreply.github.com>
Signed-off-by: bishal7679 <bishalhnj127@gmail.com>
Signed-off-by: bishal7679 <bishalhnj127@gmail.com>
Signed-off-by: bishal7679 <bishalhnj127@gmail.com>
@bishal7679
Copy link
Contributor Author

can you also provide instrustion on how to test ideally locally the release and pull-request flow?

To test the release and pull-request flow locally we need to follow the below steps:-

1. Release

  • Set the environment variable for GITHUB_TOKEN like this
     export GITHUB_TOKEN="Your GH token here"
  • after that make sure to push a new tag beforehand proceeding with release flow
     git tag -a v0.2.0 -m "message here..." && git push origin v0.2.0

NOTE:- The below command will automatically be triggered whenever a new tag will be pushed
to the repo for release

  • Now we are ready to run the release command
     go run ci/dagger.go release $GITHUB_TOKEN

2. Pull-request

  • Here just run the command with GITHUB_TOKEN set
     go run ci/dagger.go pull-request $GITHUB_TOKEN

NOTE:- This pull-request action flow will be triggered whenever a new pull-request come to this repo. At first it will check whether all test files are passed or not then will create a --snapshot for the current release and will signal for ready-to-merge

I hope this will help!!

bishal7679 added 2 commits May 8, 2024 21:26
Signed-off-by: Bishal Das  <70086051+bishal7679@users.noreply.github.com>
Signed-off-by: Bishal Das  <70086051+bishal7679@users.noreply.github.com>
@Vad1mo
Copy link
Member

Vad1mo commented May 31, 2024

We need to make sure that this PR replaces the current Makefile.
To do so builder.go should have feature and function parity with the Makefile.

Also remove in the PR, the Makefile.

@Vad1mo
Copy link
Member

Vad1mo commented May 31, 2024

also update the Readme.md, explainin how to build and test locally

@Vad1mo
Copy link
Member

Vad1mo commented May 31, 2024

The name of the generated SPDX file should have this pattern harbor_cli_0.2.x.sbom
There should be only one sbom. It makes things more confusing having two.

Signed-off-by: bishal7679 <bishalhnj127@gmail.com>
bishal7679 and others added 3 commits June 25, 2024 19:58
Signed-off-by: Bishal Das  <70086051+bishal7679@users.noreply.github.com>
Signed-off-by: bishal7679 <bishalhnj127@gmail.com>
Signed-off-by: bishal7679 <bishalhnj127@gmail.com>
@amands98
Copy link
Contributor

What is the status here ? 🤔

@bishal7679
Copy link
Contributor Author

What is the status here ? 🤔

Currently migrating from using dagger package to dagger module like dagger call and was facing some weird error of exporting the build directory from container to host but finally I got it solved today and will soon update a commit to merge!!

Signed-off-by: bishal7679 <bishalhnj127@gmail.com>
Signed-off-by: bishal7679 <bishalhnj127@gmail.com>
@bupd
Copy link
Contributor

bupd commented Jul 20, 2024

@bishal7679 please upload screenshots of the features added.

@bishal7679
Copy link
Contributor Author

@bishal7679 please upload screenshots of the features added.

Now we are able to build harbor cli through dagger call by this command

dagger call build-harbor --directory-arg . export --path=./

But the obstacle for this PR is with the release part. Getting again a weird go version error in go.mod even though its carrying the version with 1.22.5
See the logs here:
https://github.com/bishal7679/harbor-cli/actions/runs/10018821023/job/27694660442#step:4:357

@bishal7679 bishal7679 force-pushed the dagger-cicd branch 2 times, most recently from 682cd1e to 733a48d Compare July 23, 2024 18:08
Copy link
Member

@Vad1mo Vad1mo left a comment

Choose a reason for hiding this comment

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

@bupd
Copy link
Contributor

bupd commented Jul 23, 2024

@bishal7679 please squash and sign the commits.

Signed-off-by: bishal7679 <bishalhnj127@gmail.com>
Signed-off-by: bishal7679 <bishalhnj127@gmail.com>

updated goreleaser and workflow

Signed-off-by: bishal7679 <bishalhnj127@gmail.com>

updated github workflow

Signed-off-by: bishal7679 <bishalhnj127@gmail.com>

updated github workflow

Signed-off-by: bishal7679 <bishalhnj127@gmail.com>

updated github workflow

Signed-off-by: bishal7679 <bishalhnj127@gmail.com>

updated github workflow

Signed-off-by: bishal7679 <bishalhnj127@gmail.com>

updated github workflow

Signed-off-by: bishal7679 <bishalhnj127@gmail.com>

updated github workflow

Signed-off-by: bishal7679 <bishalhnj127@gmail.com>

updated gorelaser and syft version

Signed-off-by: bishal7679 <bishalhnj127@gmail.com>

updated workflow

Signed-off-by: bishal7679 <bishalhnj127@gmail.com>

changed tag push branch

Signed-off-by: bishal7679 <bishalhnj127@gmail.com>
Signed-off-by: bishal7679 <bishalhnj127@gmail.com>
@Vad1mo
Copy link
Member

Vad1mo commented Jul 26, 2024

Signed-off-by: bishal7679 <bishalhnj127@gmail.com>
Signed-off-by: bishal7679 <bishalhnj127@gmail.com>
@amands98
Copy link
Contributor

do you require any help @bishal7679

@bishal7679
Copy link
Contributor Author

Closing as completed by #133

@bishal7679 bishal7679 closed this Jul 28, 2024
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.

5 participants