Skip to content

Conversation

az-smartling
Copy link
Contributor

@az-smartling az-smartling commented Jul 13, 2025

goreleaser for builds
build cmd. Example

> smartling-cli build

Version:       2.1
ReleaseTag:    2.0
GitCommit:     22593a534c3aaa992b807423be43216e99d376ba
BuildDate:     2025-07-12T22:03:18Z
BuiltBy:       GoReleaser
GoVersion:     go1.24.3
Platform:      darwin/arm64

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @az-smartling, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the build and release process for the smartling-cli by adopting GoReleaser for automated, multi-platform binary generation. It also introduces a new command to expose detailed build-time information directly from the CLI, improving traceability and version management.

Highlights

  • Automated Build System Integration: Integrated GoReleaser to automate the build process for the smartling-cli, enabling multi-platform binary generation (Linux, Darwin, Windows for amd64, arm64, arm).
  • Dynamic Build Information: Implemented a mechanism to embed detailed build information (version, release tag, Git commit, build date, Go version, platform) directly into the compiled binary using GoReleaser's ldflags.
  • New build Command: Introduced a new smartling-cli build command that, when executed, displays the embedded build information, providing transparency about the CLI's origin and version.
  • Version Management Update: Updated the root Cobra command to dynamically retrieve its version from the embedded build information, replacing the previously hardcoded version string.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces GoReleaser for building binaries and adds a build command to display version information. The changes are a good step towards standardizing the build process.

My review has identified a critical issue in the Jenkinsfile that will likely break the S3 upload stage. I've also highlighted a high-severity security concern regarding disabled checksums in the GoReleaser configuration. Additionally, I've provided a couple of medium-severity suggestions to improve the GoReleaser configuration's maintainability and the output formatting of the new build command.

Please address these points to ensure the changes are robust and follow best practices.

Comment on lines +35 to +37
sh '''
aws-profile connectors-staging aws s3 cp ${WORKSPACE}/bin s3://smartling-connectors-releases/cli/ --acl public-read --exclude "*" --include "*"
'''

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This aws s3 cp command appears to be incorrect and will likely fail to copy any files.

  • It's missing the --recursive flag, which is required to copy the contents of a directory (${WORKSPACE}/bin).
  • The --exclude "*" --include "*" flags are ineffective without --recursive and are likely not what's intended. If the goal is to copy all files from the directory, these flags should be removed.

The previous version of this command used --recursive, which seems correct for this use case.

                sh "aws-profile connectors-staging aws s3 cp ${WORKSPACE}/bin s3://smartling-connectors-releases/cli/ --recursive --acl public-read"

Comment on lines +44 to +45
checksum:
disable: true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Disabling checksum generation is not recommended. Checksums are crucial for verifying the integrity of the downloaded artifacts, ensuring they haven't been corrupted or tampered with. Please enable checksum generation unless there is a strong reason not to. You can remove this section to use GoReleaser's default (and recommended) behavior.

checksum:
  name_template: 'checksums.txt'

Comment on lines +37 to +38
- -X github.com/Smartling/smartling-cli/cmd/helpers/build.GoVersion={{ .Env.SMARTLING_CLI_GOVERSION }}
- -X github.com/Smartling/smartling-cli/cmd/helpers/build.Platform={{ .Env.SMARTLING_CLI_PLATFORM }}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The ldflags for GoVersion and Platform are using environment variables set in the Makefile. GoReleaser provides built-in template variables for these, which would make this configuration more self-contained and less dependent on the calling environment. Using GoReleaser's variables is a best practice and improves maintainability.

      - -X github.com/Smartling/smartling-cli/cmd/helpers/build.GoVersion={{ .GoVersion }}
      - -X github.com/Smartling/smartling-cli/cmd/helpers/build.Platform={{ .Os }}/{{ .Arch }}

Comment on lines +27 to +37
return fmt.Sprintf(`
Smartling-cli is a library and CLI tool for managing Smartling projects.
Version: %s
ReleaseTag: %s
GitCommit: %s
BuildDate: %s
BuiltBy: %s
GoVersion: %s
Platform: %s
`,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The multiline string for the build information starts with a newline character. When this is printed with fmt.Println, it will result in an extra blank line at the beginning of the output, which might not be the intended formatting. Removing the leading newline from the string literal will produce cleaner output.

	return fmt.Sprintf(\`Smartling-cli is a library and CLI tool for managing Smartling projects.\n\nVersion:       %s\nReleaseTag:    %s\nGitCommit:     %s\nBuildDate:     %s\nBuiltBy:       %s\nGoVersion:     %s\nPlatform:      %s\n\`,

steps {
sh "aws-profile connectors-staging aws s3 cp ${WORKSPACE}/bin s3://smartling-connectors-releases/cli/ --recursive --acl public-read"
sh '''
aws-profile connectors-staging aws s3 cp ${WORKSPACE}/bin s3://smartling-connectors-releases/cli/ --acl public-read --exclude "*" --include "*"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a reason for this change.
Also, don't forget that jenkins does build in a clean env - docker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants