kubernetes-sigs / promo-tools

Container and file artifact promotion tooling for the Kubernetes project
Apache License 2.0
143 stars 71 forks source link

Bug installation on windows #1149

Open H0llyW00dzZ opened 6 months ago

H0llyW00dzZ commented 6 months ago

What happened:

There was a problem when installing the latest version of the software And got response:

$ go install sigs.k8s.io/promo-tools/v4/cmd/kpromo@v4.0.4
go: downloading sigs.k8s.io/promo-tools/v4 v4.0.4
go: downloading sigs.k8s.io/release-utils v0.7.4
go: downloading sigs.k8s.io/release-sdk v0.10.2
go: downloading github.com/spf13/cobra v1.7.0
go: downloading cloud.google.com/go/containeranalysis v0.10.1
go: downloading github.com/cenkalti/backoff/v4 v4.2.1
go: downloading github.com/google/go-containerregistry v0.15.2
go: downloading cloud.google.com/go/storage v1.30.1
go: downloading github.com/aws/aws-sdk-go v1.44.287
go: downloading cloud.google.com/go v0.110.2
go: downloading cloud.google.com/go/iam v1.1.1
go: downloading github.com/nozzle/throttler v0.0.0-20180817012639-2ea982251481
go: downloading github.com/sigstore/sigstore v1.7.0
go: downloading cloud.google.com/go/errorreporting v0.3.0
go: downloading github.com/common-nighthawk/go-figure v0.0.0-20210622060536-734e95fb86be
go: downloading github.com/blang/semver/v4 v4.0.0
go: downloading github.com/inconshreveable/mousetrap v1.1.0
go: downloading github.com/google/go-github/v50 v50.2.0
go: downloading github.com/sigstore/cosign/v2 v2.0.3-0.20230614173616-4a2f67e796b9
go: downloading github.com/jellydator/ttlcache/v3 v3.0.1
go: downloading github.com/blang/semver v3.5.1+incompatible
go: downloading github.com/sigstore/rekor v1.2.1
go: downloading k8s.io/apimachinery v0.27.2
go: downloading cloud.google.com/go/compute v1.19.3
go: downloading google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc
go: downloading cloud.google.com/go/grafeas v0.3.0
go: downloading cloud.google.com/go/logging v1.7.0
go: downloading github.com/opencontainers/go-digest v1.0.0
go: downloading github.com/docker/cli v23.0.5+incompatible
go: downloading github.com/docker/distribution v2.8.2+incompatible
go: downloading github.com/theupdateframework/go-tuf v0.5.2
go: downloading github.com/letsencrypt/boulder v0.0.0-20221109233200-85aa52084eaf
go: downloading golang.org/x/term v0.9.0
go: downloading github.com/spf13/viper v1.16.0
go: downloading github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20220228164355-396b2034c795
go: downloading github.com/mozillazg/docker-credential-acr-helper v0.3.0
go: downloading github.com/chrismellard/docker-credential-acr-env v0.0.0-20220119192733-fe33c00cee21
go: downloading github.com/in-toto/in-toto-golang v0.9.0
go: downloading github.com/cyberphone/json-canonicalization v0.0.0-20220623050100-57a0ce2678a7
go: downloading github.com/digitorus/timestamp v0.0.0-20221019182153-ef3b63b79b31
go: downloading github.com/go-openapi/strfmt v0.21.7
go: downloading github.com/go-openapi/swag v0.22.4
go: downloading github.com/google/certificate-transparency-go v1.1.6
go: downloading github.com/secure-systems-lab/go-securesystemslib v0.6.0
go: downloading github.com/sigstore/timestamp-authority v1.1.1
go: downloading github.com/transparency-dev/merkle v0.0.2
go: downloading github.com/go-openapi/runtime v0.26.0
go: downloading github.com/go-openapi/errors v0.20.3
go: downloading github.com/go-openapi/validate v0.22.1
go: downloading k8s.io/utils v0.0.0-20230406110748-d93618cff8a2
go: downloading gopkg.in/src-d/go-billy.v4 v4.3.2
go: downloading github.com/sergi/go-diff v1.3.1
go: downloading github.com/containerd/stargz-snapshotter/estargz v0.14.3
go: downloading github.com/docker/docker v23.0.5+incompatible
go: downloading github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d
go: downloading github.com/sigstore/protobuf-specs v0.1.0
go: downloading github.com/xanzy/go-gitlab v0.85.0
go: downloading k8s.io/api v0.26.3
go: downloading k8s.io/client-go v0.25.4
go: downloading go.step.sm/crypto v0.32.0
go: downloading github.com/sigstore/fulcio v1.3.1
go: downloading cuelang.org/go v0.5.0
go: downloading github.com/open-policy-agent/opa v0.52.0
go: downloading github.com/mitchellh/mapstructure v1.5.0
go: downloading github.com/fsnotify/fsnotify v1.6.0
go: downloading github.com/spf13/afero v1.9.5
go: downloading github.com/spf13/jwalterweatherman v1.1.0
go: downloading github.com/Azure/go-autorest/autorest/azure/auth v0.5.12
go: downloading github.com/docker/docker-credential-helpers v0.7.0
go: downloading github.com/shibumi/go-pathspec v1.3.0
go: downloading github.com/titanous/rocacheck v0.0.0-20171023193734-afe73141d399
go: downloading github.com/digitorus/pkcs7 v0.0.0-20221212123742-001c36b64ec3
go: downloading github.com/oklog/ulid v1.3.1
go: downloading go.mongodb.org/mongo-driver v1.11.3
go: downloading github.com/Azure/go-autorest/autorest v0.11.29
go: downloading golang.org/x/exp v0.0.0-20230321023759-10a507213a29
go: downloading github.com/opentracing/opentracing-go v1.2.0
go: downloading go.opentelemetry.io/otel v1.16.0
go: downloading github.com/Azure/go-autorest v14.2.0+incompatible
go: downloading go.opentelemetry.io/otel/trace v1.16.0
go: downloading k8s.io/klog/v2 v2.100.1
go: downloading cloud.google.com/go/longrunning v0.5.0
go: downloading github.com/opencontainers/image-spec v1.1.0-rc3
go: downloading github.com/klauspost/compress v1.16.5
go: downloading github.com/google/trillian v1.5.2
go: downloading golang.org/x/mod v0.11.0
go: downloading github.com/vbatts/tar-split v0.11.3
go: downloading github.com/go-openapi/analysis v0.21.4
go: downloading github.com/go-openapi/loads v0.21.2
go: downloading github.com/go-openapi/spec v0.20.9
go: downloading github.com/coreos/go-oidc/v3 v3.6.0
go: downloading github.com/go-jose/go-jose/v3 v3.0.0
go: downloading github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
go: downloading github.com/buildkite/agent/v3 v3.48.0
go: downloading github.com/spiffe/go-spiffe/v2 v2.1.6
go: downloading github.com/subosito/gotenv v1.4.2
go: downloading github.com/hashicorp/hcl v1.0.0
go: downloading gopkg.in/ini.v1 v1.67.0
go: downloading github.com/magiconair/properties v1.8.7
go: downloading github.com/Azure/azure-sdk-for-go v68.0.0+incompatible
go: downloading github.com/Azure/go-autorest/autorest/adal v0.9.22
go: downloading github.com/AliyunContainerService/ack-ram-tool/pkg/credentials/alibabacloudsdkgo/helper v0.2.0
go: downloading github.com/alibabacloud-go/cr-20160607 v1.0.1
go: downloading github.com/alibabacloud-go/cr-20181201 v1.0.10
go: downloading github.com/alibabacloud-go/darabonba-openapi v0.1.18
go: downloading github.com/alibabacloud-go/tea-utils v1.4.4
go: downloading github.com/alibabacloud-go/tea v1.1.18
go: downloading github.com/aliyun/credentials-go v1.2.3
go: downloading github.com/aws/aws-sdk-go-v2/config v1.18.26
go: downloading github.com/aws/aws-sdk-go-v2/service/ecr v1.15.0
go: downloading github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.12.0
go: downloading gopkg.in/square/go-jose.v2 v2.6.0
go: downloading github.com/go-chi/chi v4.1.2+incompatible
go: downloading github.com/Azure/go-autorest/autorest/azure/cli v0.4.6
go: downloading github.com/Azure/go-autorest/logger v0.2.1
go: downloading github.com/go-logr/logr v1.2.4
go: downloading go.opentelemetry.io/otel/metric v1.16.0
go: downloading sigs.k8s.io/structured-merge-diff/v4 v4.2.3
go: downloading github.com/go-openapi/jsonreference v0.20.1
go: downloading github.com/zeebo/errs v1.3.0
go: downloading github.com/Microsoft/go-winio v0.6.1
go: downloading github.com/Azure/go-autorest/tracing v0.6.0
go: downloading github.com/alibabacloud-go/endpoint-util v1.1.1
go: downloading github.com/alibabacloud-go/openapi-util v0.0.11
go: downloading github.com/Azure/go-autorest/autorest/date v0.3.0
go: downloading github.com/alibabacloud-go/tea-xml v1.1.2
go: downloading github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4
go: downloading github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68
go: downloading github.com/pborman/uuid v1.2.1
go: downloading github.com/jedisct1/go-minisign v0.0.0-20211028175153-1c139d1cc84b
go: downloading github.com/sassoftware/relic v7.2.1+incompatible
go: downloading filippo.io/edwards25519 v1.0.0
go: downloading github.com/aws/aws-sdk-go-v2/credentials v1.13.25
go: downloading github.com/aws/aws-sdk-go-v2/service/sso v1.12.11
go: downloading github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.11
go: downloading github.com/aws/aws-sdk-go-v2/service/sts v1.19.1
go: downloading github.com/cockroachdb/apd/v2 v2.0.2
go: downloading github.com/mpvl/unique v0.0.0-20150818121801-cbe035fff7de
go: downloading github.com/google/gnostic v0.5.7-v3refs
go: downloading github.com/tjfoc/gmsm v1.3.2
go: downloading github.com/clbanning/mxj/v2 v2.5.6
go: downloading github.com/emicklei/proto v1.10.0
go: downloading github.com/protocolbuffers/txtpbfmt v0.0.0-20220428173112-74888fd59c2b
go: downloading k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f
go: downloading github.com/golang/glog v1.1.0
go: downloading github.com/mitchellh/go-wordwrap v1.0.1
go: downloading github.com/emicklei/go-restful/v3 v3.8.0
go: downloading github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475
go: downloading github.com/ghodss/yaml v1.0.0
go: downloading github.com/OneOfOne/xxhash v1.2.8
go: downloading github.com/yashtewari/glob-intersection v0.1.0
go: downloading github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415
go: downloading github.com/agnivade/levenshtein v1.1.1
go: downloading github.com/gobwas/glob v0.2.3
go: downloading github.com/tchap/go-patricia/v2 v2.3.1
go: downloading github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb
# sigs.k8s.io/promo-tools/v4/internal/legacy/signals
C:\Users\user\go\pkg\mod\sigs.k8s.io\promo-tools\v4@v4.0.4\internal\legacy\signals\signals.go:37:11: undefined: syscall.SIGTSTP

What you expected to happen:

syscall.SIGTSTP is not available on Windows.

How to reproduce it (as minimally and precisely as possible):

run this

go install sigs.k8s.io/promo-tools/v4/cmd/kpromo@v4.0.4

Anything else we need to know?:

Windows does not use signals in the same way as Unix-like systems

Environment:

### Tasks
- [ ] https://github.com/kubernetes-sigs/promo-tools/pull/1159
cpanato commented 5 months ago

I think we never thought of running that on windows, but we can fix that for sure

are you willing to work on this to fix the issue?

H0llyW00dzZ commented 5 months ago

I think we never thought of running that on windows, but we can fix that for sure

well, was trying to install on windows

are you willing to work on this to fix the issue?

I can try by using this method

var (
    // ExitSignals are used to determine if an incoming os.Signal should cause termination.
    ExitSignals = map[os.Signal]bool{
        syscall.SIGHUP:  true,
        syscall.SIGINT:  true,
        syscall.SIGABRT: true,
        syscall.SIGILL:  true,
        syscall.SIGQUIT: true,
        syscall.SIGTERM: true,
        syscall.SIGSEGV: true,
        // syscall.SIGTSTP is conditionally added in init() not a global variable
    }
    // ExitChannel is for gracefully terminating the LogSignals() function.
    ExitChannel = make(chan bool, 1)
    // SignalChannel is for listening to OS signals.
    SignalChannel = make(chan os.Signal, 1)
    // Debug is defined globally for mocking logrus.Debug statements.
    Debug func(args ...interface{}) = logrus.Debug
)

func init() {
    // Only include SIGTSTP if not on Windows
    if runtime.GOOS != "windows" {
        ExitSignals[syscall.SIGTSTP] = true
    }
}

By adding this init() function, the syscall.SIGTSTP signal will only be added to the ExitSignals map if the program is not running on Windows. This ensures that the code is portable and will compile successfully on all platforms supported by Go.

Edit :

fixes now

image

k8s-triage-robot commented 2 months ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

xmudrii commented 2 months ago

/remove-lifecycle stale