diff --git a/.circleci/config.yml b/.circleci/config.yml index bb833034..f1b4d880 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,125 +2,52 @@ # To request a modification to the general template, file an issue on Excavator. # To manually manage the CircleCI configuration for this project, remove the .circleci/template.sh file. -working_dir: &working_dir - working_directory: /go/src/github.com/palantir/go-java-launcher +owner-repo: &owner-repo + owner-repo: palantir/go-java-launcher -darwin-linux-no-cgo: &darwin-linux-no-cgo - <<: *working_dir - docker: - - image: nmiyake/go:go-darwin-linux-no-cgo-1.10.3-t130 - environment: - CGO_ENABLED: 0 +excutor: &executor + executor: + name: go/darwin-linux-no-cgo + version: 1.15-t57 + <<: *owner-repo -go-version: &go-version - run: go version +version: 2.1 -godel-cache-restore: &godel-cache-restore - restore_cache: - keys: - - godel-cache-{{ checksum "godelw" }}-v1 - -godel-version: &godel-version - run: ./godelw version - -godel-cache-save: &godel-cache-save - save_cache: - key: godel-cache-{{ checksum "godelw" }}-v1 - paths: - - ~/.godel - -define-tests-dir: &define-tests-dir - run: echo 'export TESTS_DIR=/tmp/test-results' >> $BASH_ENV - -mkdir-tests-dir: &mkdir-tests-dir - run: mkdir -p "${TESTS_DIR}" - -godelw-verify: &godelw-verify - run: ./godelw verify --apply=false --junit-output="$TESTS_DIR/$CIRCLE_PROJECT_REPONAME-tests.xml" - -store-test-results: &store-test-results - type: test-results-store - path: /tmp/test-results - -store-artifacts: &store-artifacts - type: artifacts-store - path: /tmp/test-results - destination: test-results - -version: 2 -jobs: - verify: - <<: *darwin-linux-no-cgo - steps: - - checkout - - *go-version - - *godel-cache-restore - - *godel-version - - *godel-cache-save - - run: ./godelw verify --apply=false --skip-test - test: - <<: *darwin-linux-no-cgo - steps: - - checkout - - *go-version - - *godel-cache-restore - - *godel-version - - *godel-cache-save - - *define-tests-dir - - *mkdir-tests-dir - - run: ./godelw test --junit-output="$TESTS_DIR/$CIRCLE_PROJECT_REPONAME-tests.xml" - - *store-test-results - - *store-artifacts - dist: - <<: *darwin-linux-no-cgo - steps: - - checkout - - *go-version - - *godel-cache-restore - - *godel-version - - *godel-cache-save - - run: ./godelw dist - - save_cache: - key: dist-{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ .Environment.CIRCLE_SHA1 }}-v1 - paths: - - out - publish: - <<: *darwin-linux-no-cgo - steps: - - checkout - - *go-version - - *godel-cache-restore - - *godel-version - - restore_cache: - keys: - - dist-{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ .Environment.CIRCLE_SHA1 }}-v1 - # gödel cache only works if cached outputs are newer than source that generates it. CircleCI restore_cache restores - # the cache with the original modification dates, but the source's modification date in CI is the time of checkout. - # Manually touch all of the cache output to mark it as being generated after source was checked out. - - run: find out -exec touch {} \; - - run: ./godelw publish bintray --url https://api.bintray.com --subject palantir --repository releases --product "$CIRCLE_PROJECT_REPONAME" --username "$BINTRAY_USERNAME" --password "$BINTRAY_PASSWORD" --publish --downloads-list - -### Workflows ### -requires_products: &requires_products - - verify - - test - - dist +orbs: + go: palantir/go@0.0.15 + godel: palantir/godel@0.0.15 all-tags-filter: &all-tags-filter - filters: { tags: { only: /.*/ } } + filters: + tags: + only: /.*/ workflows: version: 2 - build-publish: + verify-test-dist-publish: jobs: - - verify: + - godel/verify: + name: verify + <<: *executor <<: *all-tags-filter - - test: + - godel/test: + name: test + <<: *executor <<: *all-tags-filter - - dist: + - godel/dist: + name: dist + <<: *executor <<: *all-tags-filter - - publish: - requires: *requires_products + - godel/bintray-publish: + name: publish + <<: *executor + bintray-subject: palantir + bintray-repo: releases + bintray-product: go-java-launcher + requires: + - verify + - test + - dist filters: tags: only: /^v?[0-9]+(\.[0-9]+)+(-rc[0-9]+)?(-alpha[0-9]+)?$/ diff --git a/changelog/@unreleased/pr-135.v2.yml b/changelog/@unreleased/pr-135.v2.yml new file mode 100644 index 00000000..908a0f42 --- /dev/null +++ b/changelog/@unreleased/pr-135.v2.yml @@ -0,0 +1,5 @@ +type: improvement +improvement: + description: Upgrade go to 1.15 and godel to 2.25 + links: + - https://github.com/palantir/go-java-launcher/pull/135 diff --git a/godel/config/godel.properties b/godel/config/godel.properties index 6c492c48..84f73028 100644 --- a/godel/config/godel.properties +++ b/godel/config/godel.properties @@ -1,2 +1,2 @@ -distributionURL=https://palantir.bintray.com/releases/com/palantir/godel/godel/2.9.0/godel-2.9.0.tgz -distributionSHA256=c00669bd13e4f3ee28833ca115a25bb2f965b7a6b55a66c4adb17eac90bd5280 +distributionURL=https://palantir.bintray.com/releases/com/palantir/godel/godel/2.25.0/godel-2.25.0.tgz +distributionSHA256=f9a58181cfc1c709e9ac4a763bce386fb4e0c5ad24a635120b7d592c60e10206 diff --git a/godelw b/godelw index 7767d8ec..d417c2e4 100755 --- a/godelw +++ b/godelw @@ -3,9 +3,9 @@ set -euo pipefail # Version and checksums for godel. Values are populated by the godel "dist" task. -VERSION=2.9.0 -DARWIN_CHECKSUM=6835d07d8271e047da881ad174372efd6c8e04c993b59b409782fbaded823660 -LINUX_CHECKSUM=59f4693ef333c369eafeb21ca3b0201ea8e4b6d8cbe4fb208f6c52b8be8a6297 +VERSION=2.25.0 +DARWIN_CHECKSUM=06c92c3b973198c0c4a57c09d853c6f2235d02d4c2098d6303211d31a9c27e5d +LINUX_CHECKSUM=731d00d75c2607258326f5cbbe3c0b4cdc3e1526c55b3539246094ca2f1a22fc # Downloads file at URL to destination path using wget or curl. Prints an error and exits if wget or curl is not present. function download { diff --git a/init/cli/start.go b/init/cli/start.go index f3c2ac6b..79bfe75c 100644 --- a/init/cli/start.go +++ b/init/cli/start.go @@ -78,7 +78,7 @@ func startCommand(ctx cli.Context, cmdCtx CommandContext) error { } defer func() { if cErr := logger.Close(); cErr != nil { - fmt.Fprintf(ctx.App.Stdout, "failed to close logger for command") + _, _ = fmt.Fprintf(ctx.App.Stdout, "failed to close logger for command") } }() cmdCtx.Command.Stdout = logger diff --git a/init/cli/status.go b/init/cli/status.go index 844b32e7..a762485a 100644 --- a/init/cli/status.go +++ b/init/cli/status.go @@ -99,7 +99,7 @@ func status(ctx cli.Context, loggers launchlib.ServiceLoggers) error { code, err := matched.ExitStatus(serviceStatus, err) if code != 0 { - fmt.Fprintln(os.Stderr, matched.Description) + _, _ = fmt.Fprintf(os.Stderr, matched.Description) if err != nil { return logErrorAndReturnWithExitCode(ctx, err, code) } diff --git a/init/cli/stop.go b/init/cli/stop.go index 4d46b9f9..ab4644ac 100644 --- a/init/cli/stop.go +++ b/init/cli/stop.go @@ -68,7 +68,7 @@ func stop(ctx cli.Context, loggers launchlib.ServiceLoggers) error { var errs bool for name := range cmds { if err := os.Remove(fmt.Sprintf(pidfileFormat, name)); err != nil && !os.IsNotExist(err) { - fmt.Fprintf(ctx.App.Stderr, "failed to remove stopped process pidfile for '%s'\n", name) + _, _ = fmt.Fprintf(ctx.App.Stderr, "failed to remove stopped process pidfile for '%s'\n", name) errs = true } } @@ -134,7 +134,7 @@ func waitForServiceToStop(ctx cli.Context, procs map[string]*os.Process) error { killedProcs = append(killedProcs, name) } } - fmt.Fprintf(ctx.App.Stdout, "processes '%v' did not stop within %d seconds, so a SIGKILL was "+ + _, _ = fmt.Fprintf(ctx.App.Stdout, "processes '%v' did not stop within %d seconds, so a SIGKILL was "+ "sent", killedProcs, numSecondsToWait) return nil } diff --git a/integration_test/go_java_launcher_integration_test.go b/integration_test/go_java_launcher_integration_test.go index 58bb4958..5a4bdbdc 100644 --- a/integration_test/go_java_launcher_integration_test.go +++ b/integration_test/go_java_launcher_integration_test.go @@ -41,7 +41,7 @@ func TestMainMethod(t *testing.T) { // part of expected output from launcher assert.Regexp(t, `Argument list to executable binary: \[.+/bin/java -Xmx4M -Xmx1g -classpath .+/github.com/palantir/go-java-launcher/integration_test/testdata Main arg1\]`, output) // expected output of Java program - assert.Regexp(t, `\nmain method\n`, string(output)) + assert.Regexp(t, `\nmain method\n`, output) } func TestPanicsWhenJavaHomeIsNotAFile(t *testing.T) { @@ -57,7 +57,7 @@ func TestMainMethodWithoutCustomConfig(t *testing.T) { assert.Regexp(t, `Failed to read custom config file, assuming no custom config: foo`, output) assert.Regexp(t, `Argument list to executable binary: \[.+/bin/java -Xmx4M -classpath .+/github.com/palantir/go-java-launcher/integration_test/testdata Main arg1\]`, output) // expected output of Java program - assert.Regexp(t, `\nmain method\n`, string(output)) + assert.Regexp(t, `\nmain method\n`, output) } func TestCreatesDirs(t *testing.T) { diff --git a/launcher/main/main.go b/launcher/main/main.go index faf2a3cc..844f446f 100644 --- a/launcher/main/main.go +++ b/launcher/main/main.go @@ -31,7 +31,7 @@ const ( ) func Exit1WithMessage(message string) { - fmt.Fprintln(os.Stderr, message) + _, _ = fmt.Fprintf(os.Stderr, message) os.Exit(1) } diff --git a/launchlib/config.go b/launchlib/config.go index bcf9c8fe..0c06f734 100644 --- a/launchlib/config.go +++ b/launchlib/config.go @@ -266,7 +266,7 @@ func parseCustomConfig(yamlString []byte) (PrimaryCustomLauncherConfig, error) { func getCustomConfigFromFile(customConfigFile string, stdout io.Writer) (PrimaryCustomLauncherConfig, error) { if customData, err := ioutil.ReadFile(customConfigFile); err != nil { - fmt.Fprintln(stdout, "Failed to read custom config file, assuming no custom config:", + _, _ = fmt.Fprintf(stdout, "Failed to read custom config file, assuming no custom config: %s\n", customConfigFile) return PrimaryCustomLauncherConfig{}, nil } else if customConfig, err := parseCustomConfig(customData); err != nil { diff --git a/launchlib/launcher.go b/launchlib/launcher.go index cd1e3047..104080ef 100644 --- a/launchlib/launcher.go +++ b/launchlib/launcher.go @@ -74,11 +74,11 @@ func compileCmdFromConfig( err = errors.Wrapf(err, "unable to close command compilation logger") } }() - fmt.Fprintf(logger, "Launching with static configuration %v and custom configuration %v\n", + _, _ = fmt.Fprintf(logger, "Launching with static configuration %v and custom configuration %v\n", *staticConfig, *customConfig) workingDir := getWorkingDir() - fmt.Fprintln(logger, "Working directory:", workingDir) + _, _ = fmt.Fprintf(logger, "Working directory: %s\n", workingDir) var args []string var executable string @@ -89,11 +89,11 @@ func compileCmdFromConfig( if javaHomeErr != nil { return nil, javaHomeErr } - fmt.Fprintln(logger, "Using JAVA_HOME:", javaHome) + _, _ = fmt.Fprintf(logger, "Using JAVA_HOME: %s\n", javaHome) classpath := joinClasspathEntries(absolutizeClasspathEntries(workingDir, staticConfig.JavaConfig.Classpath)) - fmt.Fprintln(logger, "Classpath:", classpath) + _, _ = fmt.Fprintf(logger, "Classpath: %s\n", classpath) executable, executableErr = verifyPathIsSafeForExec(path.Join(javaHome, "/bin/java")) if executableErr != nil { @@ -128,7 +128,7 @@ func compileCmdFromConfig( args = cgexecArgs } - fmt.Fprintf(logger, "Argument list to executable binary: %v\n\n", args) + _, _ = fmt.Fprintf(logger, "Argument list to executable binary: %v\n\n", args) env := replaceEnvironmentVariables(merge(staticConfig.Env, customConfig.Env)) @@ -142,7 +142,7 @@ func MkDirs(dirs []string, stdout io.Writer) error { return fmt.Errorf("Cannot create directory with non [A-Za-z0-9] characters: %s", dir) } - fmt.Fprintf(stdout, "Creating directory: %s\n", dir) + _, _ = fmt.Fprintf(stdout, "Creating directory: %s\n", dir) if err := os.MkdirAll(dir, 0700); err != nil { return err }