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

Make in possible to override endpoints for agent storage #3

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 28 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.PHONY: checksum-guestagent checksum-guestagent-updater build-guestagent build-guestagent-updater sync-to-github

VERSION?=0.0.0
ENVIRONMENT?=Yandex

all:

Expand All @@ -19,29 +20,46 @@ docker-%:
@echo "+ Run target \`$(INNER_TARGET)\` inside Docker"
$(RUN_DOCKER) $(INNER_TARGET)

GO_BUILD_PARAMS = GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-buildid=none -X main.version=${VERSION}" -trimpath
GO_CHECKSUM_PARAMS = GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-buildid=none -X main.version=${VERSION}" -trimpath
# Default build params (Yandex Cloud)
LDFLAGS = -buildid=none -X main.version=${VERSION}
GO_BUILD_PARAMS = GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="${LDFLAGS}" -trimpath
GO_CHECKSUM_PARAMS = GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="${LDFLAGS}" -trimpath
GUEST_AGENT_NAME = yandex-guest-agent.exe
GUEST_AGENT_UPDATER_NAME = yandex-guest-agent-updater.exe

# Build params for Nebius
ifeq ($(ENVIRONMENT),Nebius) # Nebius
NEBIUS_LDFLAGS = $(LDFLAGS) \
-X 'marketplace-yaga/windows/internal/updater.VersionRemoteEndpoint=https://storage.il.nebius.cloud' \
-X 'marketplace-yaga/windows/internal/updater.GuestAgentBucket=yc-guestagent'
GO_BUILD_PARAMS = GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="$(NEBIUS_LDFLAGS)" -trimpath
GO_CHECKSUM_PARAMS = GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="$(NEBIUS_LDFLAGS)" -trimpath
GUEST_AGENT_NAME = nebius-guest-agent.exe
GUEST_AGENT_UPDATER_NAME = nebius-guest-agent-updater.exe
endif

checksum-guestagent: go-clean
@echo "+ $@"
${GO_CHECKSUM_PARAMS} -o yandex-guest-agent.exe.checksum windows/cmd/yandex-guest-agent/yandex-guest-agent.go
sha256sum yandex-guest-agent.exe.checksum
rm yandex-guest-agent.exe.checksum
${GO_CHECKSUM_PARAMS} -o ${GUEST_AGENT_NAME}.checksum windows/cmd/yandex-guest-agent/yandex-guest-agent.go
sha256sum ${GUEST_AGENT_NAME}.checksum
rm ${GUEST_AGENT_NAME}.checksum

checksum-guestagent-updater: go-clean
@echo "+ $@"
${GO_CHECKSUM_PARAMS} -o yandex-guest-agent-updater.exe.checksum windows/cmd/yandex-guest-agent-updater/yandex-guest-agent-updater.go
sha256sum yandex-guest-agent-updater.exe.checksum
rm yandex-guest-agent-updater.exe.checksum
${GO_CHECKSUM_PARAMS} -o ${GUEST_AGENT_UPDATER_NAME}.checksum windows/cmd/yandex-guest-agent-updater/yandex-guest-agent-updater.go
sha256sum ${GUEST_AGENT_UPDATER_NAME}.checksum
rm ${GUEST_AGENT_UPDATER_NAME}.checksum


build-guestagent: go-clean
@echo "+ $@"
${GO_BUILD_PARAMS} -o yandex-guest-agent.exe windows/cmd/yandex-guest-agent/yandex-guest-agent.go
${GO_BUILD_PARAMS} -o ${GUEST_AGENT_NAME} windows/cmd/yandex-guest-agent/yandex-guest-agent.go

build-guestagent-updater: go-clean
@echo "+ $@"
${GO_BUILD_PARAMS} -o yandex-guest-agent-updater.exe windows/cmd/yandex-guest-agent-updater/yandex-guest-agent-updater.go
@echo ${ENVIRONMENT}
@echo ${NEBIUS_LDFLAGS}
${GO_BUILD_PARAMS} -o ${GUEST_AGENT_UPDATER_NAME} windows/cmd/yandex-guest-agent-updater/yandex-guest-agent-updater.go

# Docker preparation
image:
Expand Down
90 changes: 2 additions & 88 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,103 +1,17 @@
module marketplace-yaga

go 1.19
go 1.16

require (
github.com/GehirnInc/crypt v0.0.0-20200316065508-bb7000b8a962
github.com/alessio/shellescape v1.4.1
github.com/blang/semver/v4 v4.0.0
github.com/cenkalti/backoff/v4 v4.1.2
github.com/go-resty/resty/v2 v2.7.0
github.com/gofrs/uuid v4.2.0+incompatible
github.com/google/uuid v1.2.0
github.com/gruntwork-io/terratest v0.41.6
github.com/jarcoal/httpmock v1.0.8
github.com/spf13/afero v1.6.0
github.com/spf13/cobra v1.3.0
github.com/stretchr/testify v1.7.0
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07
github.com/yandex-cloud/go-genproto v0.0.0-20221010111330-0b826c42c781
github.com/yandex-cloud/go-sdk v0.0.0-20221010112024-bf39039cc451
go.uber.org/zap v1.19.1
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5
golang.org/x/sys v0.0.0-20220517195934-5e4e11fc645e
)

require (
cloud.google.com/go v0.99.0 // indirect
cloud.google.com/go/storage v1.10.0 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/aws/aws-sdk-go v1.40.56 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-errors/errors v1.0.2-0.20180813162953-d98b870cc4e0 // indirect
github.com/go-logr/logr v0.2.0 // indirect
github.com/go-sql-driver/mysql v1.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.1.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/googleapis/gax-go/v2 v2.1.1 // indirect
github.com/googleapis/gnostic v0.4.1 // indirect
github.com/gruntwork-io/go-commons v0.8.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-getter v1.6.1 // indirect
github.com/hashicorp/go-multierror v1.1.0 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/go-version v1.3.0 // indirect
github.com/hashicorp/hcl/v2 v2.9.1 // indirect
github.com/hashicorp/terraform-json v0.13.0 // indirect
github.com/imdario/mergo v0.3.11 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.13.0 // indirect
github.com/mattn/go-zglob v0.0.2-0.20190814121620-e3c945676326 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.0.0 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pquerna/otp v1.2.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.2.0 // indirect
github.com/tmccombs/hcl2json v0.3.3 // indirect
github.com/ulikunitz/xz v0.5.8 // indirect
github.com/urfave/cli v1.22.2 // indirect
github.com/zclconf/go-cty v1.9.1 // indirect
go.opencensus.io v0.23.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
golang.org/x/net v0.0.0-20211029224645-99673261e6eb // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/api v0.62.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect
google.golang.org/grpc v1.42.0 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/api v0.20.6 // indirect
k8s.io/apimachinery v0.20.6 // indirect
k8s.io/client-go v0.20.6 // indirect
k8s.io/klog/v2 v2.4.0 // indirect
k8s.io/utils v0.0.0-20201110183641-67b214c5f920 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.0.3 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e
)
Loading