-
Notifications
You must be signed in to change notification settings - Fork 622
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create stubs for non-windows code * Disable dotnet profiling options for Windows * Implement windows-specific parts * Fix configuration type * Add MSI package definition * Embed windows version info at build * Add agent run mode * Rework windows-dev build * Add target manager * Rework CLI * Allow pyroscope agent to run without a config file * Rework agent logging * Improve error messages Co-authored-by: Dmitry Filimonov <dmitry@pyroscope.io>
- Loading branch information
1 parent
a39670c
commit c1babda
Showing
61 changed files
with
1,627 additions
and
684 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
FROM golang:1.16.4-alpine3.12 as go-builder | ||
|
||
RUN apk add --no-cache make git zstd gcc g++ libc-dev musl-dev bash mingw-w64-gcc | ||
|
||
WORKDIR /opt/pyroscope/ | ||
|
||
COPY pkg ./pkg | ||
COPY cmd ./cmd | ||
COPY scripts ./scripts | ||
COPY go.mod go.sum pyroscope.go ./ | ||
|
||
# Generate .syso object file. | ||
RUN source scripts/packages/git-info && go run scripts/windows/generate-windows-version-info/main.go \ | ||
-version "$GIT_TAG" \ | ||
-icon scripts/windows/resources/app.ico \ | ||
-out cmd/pyroscope/resource.syso | ||
|
||
## Build for Windows x64 only. | ||
RUN GOOS=windows GOARCH=amd64 go build \ | ||
-trimpath -ldflags "$(scripts/generate-build-flags.sh)" \ | ||
-tags dotnetspy,debugspy \ | ||
-o pyroscope.exe \ | ||
./cmd/pyroscope | ||
|
||
FROM harbottle/wix AS msi-builder | ||
|
||
COPY --from=go-builder /opt/pyroscope/pyroscope.exe pyroscope.exe | ||
COPY scripts/windows/pyroscope.wsx pyroscope.wsx | ||
COPY scripts/windows/resources resources | ||
|
||
# Build MSI package. | ||
RUN candle -arch x64 -ext WixUtilExtension \ | ||
-dPyroscopeSourceExecutable=pyroscope.exe \ | ||
pyroscope.wsx && \ | ||
light -sval -ext WixUtilExtension \ | ||
pyroscope.wixobj | ||
|
||
FROM scratch AS msi-exporter | ||
COPY --from=msi-builder /mnt/workspace/pyroscope.exe / | ||
COPY --from=msi-builder /mnt/workspace/pyroscope.msi / |
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 |
---|---|---|
@@ -1,17 +1,14 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/fatih/color" | ||
|
||
"github.com/pyroscope-io/pyroscope/pkg/cli" | ||
"github.com/pyroscope-io/pyroscope/pkg/config" | ||
) | ||
|
||
func main() { | ||
cfg := &config.Config{} | ||
err := cli.Start(cfg) | ||
if err != nil { | ||
os.Stderr.Write([]byte(color.RedString("Error: ") + err.Error() + "\n\n")) | ||
if err := cli.Start(new(config.Config)); err != nil { | ||
fatalf("%s %v\n\n", color.RedString("Error:"), err) | ||
} | ||
} |
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,13 @@ | ||
// +build !windows | ||
|
||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
) | ||
|
||
func fatalf(format string, args ...interface{}) { | ||
_, _ = fmt.Fprintf(os.Stderr, format, args...) | ||
os.Exit(1) | ||
} |
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,25 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/kardianos/service" | ||
"golang.org/x/sys/windows/svc/eventlog" | ||
) | ||
|
||
func fatalf(format string, args ...interface{}) { | ||
msg := fmt.Sprintf(format, args...) | ||
if service.Interactive() { | ||
_, _ = fmt.Fprint(os.Stderr, msg) | ||
os.Exit(1) | ||
} | ||
log, err := eventlog.Open("Pyroscope") | ||
if err == nil { | ||
err = log.Error(1, msg) | ||
} | ||
if err != nil { | ||
panic(msg) | ||
} | ||
os.Exit(1) | ||
} |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.