Skip to content

Conversation

rumstead
Copy link
Member

Background

After merging in Azure go modules, we have to enable CGO to build the Darwin binary of the Argo CD CLI. That broke goreleaser because CGO wasn't enabled in our CI templates. I attempted to enable CGO for only Darwin builds, but the Linux VMs that the builds run on do not have the Darwin C headers to compile a CGO enabled Darwin binary.

Testing

goreleaser syntax is correct

❯ goreleaser check                                  
  • checking                                 path=.goreleaser.yaml
  • 1 configuration file(s) validated
  • thanks for using GoReleaser!

goreleaser can create all the binaries on a Darwin machine

❯ GIT_TREE_STATE=clean KUBECTL_VERSION=1 GITHUB_TOKEN=foo goreleaser release --skip before --clean --snapshot 
  • skipping announce, before, publish, and validate...
  • cleaning distribution directory
  • loading environment variables
    • using token from  $GITHUB_TOKEN 
  • getting and validating git state
    • git state                                      commit=a1faf0265f5256f0b09e045f8486421359e3211f branch=HEAD current_tag=v3.0.9 previous_tag=v3.0.8 dirty=true
    • pipe skipped or partially skipped              reason=disabled during snapshot mode
  • parsing tag
  • setting defaults
  • snapshotting
    • building snapshot...                           version=2.6.0
  • ensuring distribution directory
  • setting up metadata
  • writing release metadata
  • loading go mod information
  • build prerequisites
  • building binaries
    • building                                       binary=dist/argocd-cli_darwin_arm64_v8.0/argocd-darwin-arm64
    • building                                       binary=dist/argocd-cli_windows_amd64_v1/argocd-windows-amd64.exe
    • building                                       binary=dist/argocd-cli_darwin_amd64_v1/argocd-darwin-amd64
    • building                                       binary=dist/argocd-cli_linux_arm64_v8.0/argocd-linux-arm64
    • building                                       binary=dist/argocd-cli_linux_ppc64le_power8/argocd-linux-ppc64le
    • building                                       binary=dist/argocd-cli_linux_s390x/argocd-linux-s390x
    • building                                       binary=dist/argocd-cli_linux_amd64_v1/argocd-linux-amd64
  • archives
    • archiving                                      binary=argocd-linux-arm64 name=argocd-linux-arm64
    • archiving                                      binary=argocd-darwin-amd64 name=argocd-darwin-amd64
    • archiving                                      binary=argocd-darwin-arm64 name=argocd-darwin-arm64
    • archiving                                      binary=argocd-windows-amd64.exe name=argocd-windows-amd64.exe
    • archiving                                      binary=argocd-linux-ppc64le name=argocd-linux-ppc64le
    • archiving                                      binary=argocd-linux-s390x name=argocd-linux-s390x
    • archiving                                      binary=argocd-linux-amd64 name=argocd-linux-amd64
    • artifact already present in the list           name=argocd-linux-arm64
      details=
      │ this might cause errors when publishing
      │ please make sure your configuration is correct
    • artifact already present in the list           name=argocd-darwin-amd64
      details=
      │ this might cause errors when publishing
      │ please make sure your configuration is correct
    • artifact already present in the list           name=argocd-darwin-arm64
      details=
      │ this might cause errors when publishing
      │ please make sure your configuration is correct
    • artifact already present in the list           name=argocd-windows-amd64.exe
      details=
      │ this might cause errors when publishing
      │ please make sure your configuration is correct
    • artifact already present in the list           name=argocd-linux-ppc64le
      details=
      │ this might cause errors when publishing
      │ please make sure your configuration is correct
    • artifact already present in the list           name=argocd-linux-s390x
      details=
      │ this might cause errors when publishing
      │ please make sure your configuration is correct
    • artifact already present in the list           name=argocd-linux-amd64
      details=
      │ this might cause errors when publishing
      │ please make sure your configuration is correct
  • calculating checksums
  • writing artifacts metadata
  • release succeeded after 1m6s
  • thanks for using GoReleaser!

I can run both versions and they give the expected output

❯ CGO_ENABLED=0 GODEBUG="tarinsecurepath=0,zipinsecurepath=0" go build -v -ldflags '-extldflags "-static"' -o ./dist/argocd-no-cgo ./cmd
❯ ARGOCD_BINARY_NAME=argocd-k8s-auth ./dist/argocd-no-cgo azure
2025/06/20 17:22:41 CGO is not enabled, cannot use workload identity token provider

# CGO is enabled
❯ make cli-local
❯ ARGOCD_BINARY_NAME=argocd-k8s-auth ./dist/argocd azure
{"level":"fatal","msg":"client ID cannot be empty","time":"2025-06-20T17:23:58-04:00"}

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Toolchain Guide
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

rumstead added 4 commits June 17, 2025 14:21
…elease

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
…elease

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
… linux

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
@rumstead rumstead requested review from a team as code owners June 20, 2025 21:38
Copy link

bunnyshell bot commented Jun 20, 2025

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

Copy link

codecov bot commented Jun 20, 2025

Codecov Report

Attention: Patch coverage is 73.33333% with 4 lines in your changes missing coverage. Please review.

Project coverage is 60.24%. Comparing base (5c9a5ef) to head (514b0ab).
Report is 10 commits behind head on master.

Files with missing lines Patch % Lines
util/workloadidentity/workloadidentity_cgo.go 73.33% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #23507      +/-   ##
==========================================
- Coverage   60.25%   60.24%   -0.02%     
==========================================
  Files         344      345       +1     
  Lines       59084    59084              
==========================================
- Hits        35604    35597       -7     
- Misses      20611    20613       +2     
- Partials     2869     2874       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@ishitasequeira ishitasequeira left a comment

Choose a reason for hiding this comment

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

Overall the change looks good!! I like the way of using flags with go:build in each file.

Copy link
Collaborator

@leoluz leoluz left a comment

Choose a reason for hiding this comment

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

LGTM

@crenshaw-dev crenshaw-dev merged commit e0f4b00 into argoproj:master Jun 23, 2025
28 checks passed
@crenshaw-dev
Copy link
Member

/cherry-pick release-3.1

gcp-cherry-pick-bot bot pushed a commit that referenced this pull request Jun 23, 2025
… linux (#23507)

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
crenshaw-dev pushed a commit that referenced this pull request Jun 23, 2025
… linux (cherry-pick #23507) (#23526)

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Co-authored-by: rumstead <37445536+rumstead@users.noreply.github.com>
cjcocokrisp pushed a commit to cjcocokrisp/argo-cd that referenced this pull request Jun 24, 2025
… linux (argoproj#23507)

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
@rumstead
Copy link
Member Author

/cherry-pick release-3.0

gcp-cherry-pick-bot bot pushed a commit that referenced this pull request Jul 10, 2025
… linux (#23507)

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
rumstead added a commit that referenced this pull request Jul 10, 2025
… linux (cherry-pick #23507) (#23735)

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Co-authored-by: rumstead <37445536+rumstead@users.noreply.github.com>
enneitex pushed a commit to enneitex/argo-cd that referenced this pull request Aug 24, 2025
… linux (argoproj#23507)

Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
Signed-off-by: enneitex <etienne.divet@gmail.com>
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.

5 participants