-
Notifications
You must be signed in to change notification settings - Fork 187
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
WIP: Magefile POC #819
Draft
mattdurham
wants to merge
9
commits into
main
Choose a base branch
from
magefile
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
WIP: Magefile POC #819
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
89eeaa9
git checkin changes for crypto
mattdurham bfbd069
Check in changes to support windows cngcrypto
mattdurham 26c8af8
Disable cngcrypto containers
mattdurham 85471b5
Fix changelog message.
mattdurham 6dbd5f2
add support for magefiles
mattdurham fe9a427
Magefile poc
mattdurham 3079a2b
main merge
mattdurham fc6334b
rollback packaging
mattdurham 59997fb
cleanup
mattdurham File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
//go:build mage | ||
|
||
package main | ||
|
||
import ( | ||
"github.com/magefile/mage/mg" | ||
"github.com/magefile/mage/sh" | ||
) | ||
|
||
// AlloyBuildAll builds the all the dist targets. | ||
func AlloyBuildAll() { | ||
mg.SerialDeps( | ||
AlloyDarwinArm64, | ||
AlloyDarwinAmd64, | ||
AlloyLinuxArm64, | ||
AlloyLinuxAmd64, | ||
AlloyLinuxs390x, | ||
AlloyLinuxPpc64le, | ||
AlloyWindowsAmd64, | ||
AlloyFreebsdAmd64, | ||
) | ||
} | ||
|
||
// Alloy builds the current OS and ARCH system to `build/alloy`. | ||
func Alloy() error { | ||
return buildAlloy("", "", "", "build/alloy") | ||
} | ||
|
||
// AlloyGoMod runs `go mod vendor` in the current directory. | ||
func AlloyGoMod() error { | ||
return runGoMod("", "") | ||
} | ||
|
||
// AlloyImage builds the linux amd64 docker image for alloy. | ||
func AlloyImage() error { | ||
args := map[string]string{ | ||
"DOCKER_BUILDKIT": "1", | ||
} | ||
version, err := sh.Output("bash", "./tools/image-tag") | ||
if err != nil { | ||
return err | ||
} | ||
err = ExecNoEnv("build image", "go", "mod", "vendor") | ||
if err != nil { | ||
return err | ||
} | ||
return Exec("build image", args, | ||
"docker", | ||
"build", | ||
"--platform", "linux/amd64", | ||
"--build-arg", "RELEASE_BUILD=0", | ||
"--build-arg", "VERSION="+version, | ||
"--build-arg", "BUILDPLATFORM=linux/amd64", | ||
"--build-arg", "TARGETOS=linux", | ||
"--build-arg", "TARGETARCH=amd64", | ||
"-t", "grafana/alloy:latest", | ||
"-f", "Dockerfile", | ||
".", | ||
) | ||
} | ||
|
||
// AlloyImageBoringCrypto builds the linux amd64 docker image for alloy with boring crypto. | ||
func AlloyImageBoringCrypto() error { | ||
args := map[string]string{ | ||
"DOCKER_BUILDKIT": "1", | ||
} | ||
version, err := sh.Output("bash", "./tools/image-tag") | ||
if err != nil { | ||
return err | ||
} | ||
err = ExecNoEnv("build image", "go", "mod", "vendor") | ||
if err != nil { | ||
return err | ||
} | ||
return Exec("build image", args, | ||
"docker", | ||
"build", | ||
"--platform", "linux/amd64", | ||
"--build-arg", "RELEASE_BUILD=0", | ||
"--build-arg", "VERSION="+version, | ||
"--build-arg", "BUILDPLATFORM=linux/amd64", | ||
"--build-arg", "TARGETOS=linux", | ||
"--build-arg", "TARGETARCH=amd64", | ||
"--build-arg", "GOEXPERIMENT=boringcrypto", | ||
"-t", "grafana/alloy:boringcrypto", | ||
"-f", "Dockerfile", | ||
".", | ||
) | ||
} | ||
|
||
// AlloyImageWindows builds the windows amd64 docker image for alloy. | ||
func AlloyImageWindows() error { | ||
args := map[string]string{ | ||
"DOCKER_BUILDKIT": "1", | ||
} | ||
version, err := sh.Output("bash", "./tools/image-tag") | ||
if err != nil { | ||
return err | ||
} | ||
err = ExecNoEnv("build image", "go", "mod", "vendor") | ||
if err != nil { | ||
return err | ||
} | ||
return Exec("build image", args, | ||
"docker", | ||
"build", | ||
"--platform", "windows/amd64", | ||
"--build-arg", "RELEASE_BUILD=0", | ||
"--build-arg", "VERSION="+version, | ||
"--build-arg", "BUILDPLATFORM=windows/amd64", | ||
"--build-arg", "TARGETOS=windows", | ||
"--build-arg", "TARGETARCH=amd64", | ||
"-t", "grafana/alloy:nanoserver-1809", | ||
"-f", "Dockerfile.windows", | ||
".", | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//go:build mage | ||
|
||
package main | ||
|
||
const buildVersion = "v0.1.0" | ||
const buildImage = "grafana/alloy-build-image:" + buildVersion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
//go:build mage | ||
|
||
package main | ||
|
||
func AlloyDarwinArm64() error { | ||
return buildAlloy( | ||
"darwin", | ||
"arm64", | ||
"netgo builtinassets", | ||
"", | ||
) | ||
} | ||
|
||
func AlloyDarwinAmd64() error { | ||
return buildAlloy( | ||
"darwin", | ||
"amd64", | ||
"netgo builtinassets", | ||
"", | ||
) | ||
} | ||
|
||
func AlloyLinuxs390x() error { | ||
return buildAlloy( | ||
"linux", | ||
"s390x", | ||
"netgo builtinassets promtail_journal_enabled", | ||
"", | ||
) | ||
} | ||
|
||
func AlloyLinuxPpc64le() error { | ||
return buildAlloy( | ||
"linux", | ||
"ppc64le", | ||
"netgo builtinassets promtail_journal_enabled", | ||
"", | ||
) | ||
} | ||
|
||
func AlloyLinuxArm64() error { | ||
return buildAlloy( | ||
"linux", | ||
"ppc64le", | ||
"netgo builtinassets promtail_journal_enabled", | ||
"", | ||
) | ||
} | ||
|
||
func AlloyLinuxAmd64() error { | ||
return buildAlloy( | ||
"linux", | ||
"amd64", | ||
"netgo builtinassets promtail_journal_enabled", | ||
"", | ||
) | ||
} | ||
|
||
func AlloyLinuxAmd64BoringCrypto() error { | ||
return buildAlloyFull( | ||
"linux", | ||
"amd64", | ||
"netgo builtinassets promtail_journal_enabled", | ||
"", | ||
"boringcrypto", | ||
) | ||
} | ||
|
||
func AlloyWindowsAmd64() error { | ||
return buildAlloy( | ||
"windows", | ||
"amd64", | ||
"builtinassets", | ||
"", | ||
) | ||
} | ||
|
||
func AlloyFreebsdAmd64() error { | ||
return buildAlloy( | ||
"freebsd", | ||
"amd64", | ||
"netgo builtinassets", | ||
"", | ||
) | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add this back in once I tighten everything up