-
Notifications
You must be signed in to change notification settings - Fork 12
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
[CLI-2823] Add chocolatey to goreleaser config #2365
Draft
sgagniere
wants to merge
21
commits into
main
Choose a base branch
from
cli-2823
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
b8faf55
Add Chocolatey to the goreleaser config file
sgagniere f1f3959
small changes
sgagniere 7f04ea9
Merge branch 'main' of github.com:confluentinc/cli into cli-2823
sgagniere e1c3122
add missing entry
sgagniere a2d1eeb
change comment
sgagniere ede4a2a
temporarily hardcode true for because goreleaser check reports an er…
sgagniere a0c9f3f
Merge branch 'main' into cli-2823
brianstrauch 9be35c3
Merge branch 'main' of github.com:confluentinc/cli into cli-2823
sgagniere f98f0c4
Rearrange pre and post hooks
sgagniere dc29d94
some prep for building choco packages in docker
sgagniere f92d854
move windows builds outside of the main goreleaser file
sgagniere 91ebd77
forgot to remove archive-chocolatey
sgagniere e365ba3
install choco in the windows builder docker image
sgagniere 4bc9aea
fix typo
sgagniere d1be0cc
Add signing certificate to .gitignore
sgagniere cb3c9e0
move osslsigncode into the windows builder base image
sgagniere 6f5ebd2
Can't sign in place with osslsigncode in Docker for some reason
sgagniere c872a56
Hide windows signing certificate in Docker using secrets feature
sgagniere 8b640cd
Add chocolateys block to goreleaser-windows
sgagniere bb3affb
typo fix and add .dockerignore
sgagniere 6282f3b
don't package the chocolatey version of windows twice
sgagniere File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
CLIEVCodeSigningCertificate2.pfx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
CLIEVCodeSigningCertificate2.pfx | ||
|
||
/dist/ | ||
/docs/ | ||
/legal/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
project_name: confluent | ||
|
||
dist: prebuilt | ||
|
||
builds: | ||
- id: confluent-windows-amd64 | ||
binary: confluent | ||
main: cmd/confluent/main.go | ||
ldflags: | ||
- -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}} -buildmode=exe | ||
gcflags: | ||
- all=-trimpath={{.Env.HOME}}/git | ||
asmflags: | ||
- all=-trimpath={{.Env.HOME}}/git | ||
env: | ||
- CGO_ENABLED=1 | ||
- CC=x86_64-w64-mingw32-gcc | ||
- CXX=x86_64-w64-mingw32-g++ | ||
- CGO_LDFLAGS=${CGO_LDFLAGS} -static | ||
goos: | ||
- windows | ||
goarch: | ||
- amd64 | ||
hooks: | ||
post: | ||
- cmd: osslsigncode sign -n "Confluent CLI" -i "https://confluent.io" -pkcs12 /run/secrets/CLIEVCodeSigningCertificate2.pfx -in {{ .Path }} -out /sign-temp/confluent.exe | ||
- cmd: rm -f {{ .Path }} | ||
- cmd: mv /sign-temp/confluent.exe {{ .Path }} | ||
- id: confluent-windows-amd64-disableupdates | ||
binary: confluent | ||
main: cmd/confluent/main.go | ||
ldflags: | ||
- -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}} -X main.disableUpdates=true -buildmode=exe | ||
gcflags: | ||
- all=-trimpath={{.Env.HOME}}/git | ||
asmflags: | ||
- all=-trimpath={{.Env.HOME}}/git | ||
env: | ||
- CGO_ENABLED=1 | ||
- CC=x86_64-w64-mingw32-gcc | ||
- CXX=x86_64-w64-mingw32-g++ | ||
- CGO_LDFLAGS=${CGO_LDFLAGS} -static | ||
goos: | ||
- windows | ||
goarch: | ||
- amd64 | ||
hooks: | ||
post: | ||
- cmd: osslsigncode sign -n "Confluent CLI" -i "https://confluent.io" -pkcs12 /run/secrets/CLIEVCodeSigningCertificate2.pfx -in {{ .Path }} -out /sign-temp-disableupdates/confluent.exe | ||
- cmd: rm -f {{ .Path }} | ||
- cmd: mv /sign-temp-disableupdates/confluent.exe {{ .Path }} | ||
|
||
release: | ||
disable: true | ||
|
||
archives: | ||
- id: archive-disableupdates | ||
format: zip | ||
builds: | ||
- confluent-windows-amd64-disableupdates | ||
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}_disableupdates" | ||
wrap_in_directory: "{{ .ProjectName }}" | ||
files: | ||
- LICENSE | ||
- legal/**/* | ||
|
||
chocolateys: | ||
- name: confluent | ||
ids: | ||
- archive-disableupdates | ||
owners: confluentinc | ||
title: Confluent CLI | ||
authors: Confluent Inc. | ||
project_url: https://docs.confluent.io/confluent-cli/current/overview.html | ||
url_template: "https://s3-us-west-2.amazonaws.com/confluent.cloud/confluent-cli/archives/{{ .Version }}/{{ .ArtifactName }}" | ||
copyright: 2023 Confluent Inc. | ||
license_url: https://github.com/confluentinc/cli/blob/main/LICENSE | ||
require_license_acceptance: false | ||
project_source_url: https://github.com/confluentinc/cli | ||
bug_tracker_url: https://github.com/confluentinc/cli/issues | ||
summary: CLI for Confluent Cloud and Confluent Platform | ||
description: CLI for Confluent Cloud and Confluent Platform | ||
release_notes: https://docs.confluent.io/confluent-cli/current/release-notes.html | ||
skip_publish: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM --platform=linux/amd64 050879227952.dkr.ecr.us-west-1.amazonaws.com/confluentinc/cli-ubuntu-base-windows-amd64:latest | ||
|
||
COPY . /cli/ | ||
|
||
RUN export GO_VERSION=$(cat /cli/.go-version) && \ | ||
wget "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" && \ | ||
sudo tar -C /usr/local -xzf "go${GO_VERSION}.linux-amd64.tar.gz" | ||
|
||
ENV PATH=${PATH}:/usr/local/go/bin:/root/go/bin | ||
|
||
RUN --mount=type=secret,id=CLIEVCodeSigningCertificate2.pfx \ | ||
cd /cli && \ | ||
make gorelease-windows-amd64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
FROM --platform=linux/amd64 ubuntu:jammy-20231211.1 | ||
|
||
RUN apt update | ||
|
||
RUN apt -y install make sudo | ||
|
||
RUN sudo apt -y install git wget build-essential curl mingw-w64 ca-certificates gnupg osslsigncode | ||
|
||
# The official choco linux image does not have a new enough mingw-w64 version to successfully cross compile the CLI | ||
# So we build & install choco from source on Ubuntu Jammy (which is able to compile the CLI) | ||
# mono is required to run choco & .NET is required to build it | ||
# https://github.com/chocolatey/choco#other-platforms | ||
RUN sudo gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && \ | ||
echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list && \ | ||
sudo apt update && \ | ||
sudo apt -y install mono-devel | ||
|
||
RUN sudo apt install -y dotnet-sdk-7.0 aspnetcore-runtime-7.0 | ||
|
||
RUN git clone https://github.com/chocolatey/choco.git && \ | ||
cd /choco && \ | ||
git checkout 2.2.2 && \ | ||
./build.sh && \ | ||
cp -r ./code_drop/temp/_PublishedApps/choco /opt/chocolatey && \ | ||
mkdir /opt/chocolatey/lib && \ | ||
cp ./docker/choco_wrapper /usr/local/bin/choco | ||
|
||
ENV ChocolateyInstall=/opt/chocolatey | ||
|
||
RUN mkdir -p /cli /sign-temp /sign-temp-disableupdates |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
function cleanup { | ||
shred --force --remove --zero --iterations=10 CLIEVCodeSigningCertificate2.pfx | ||
rm -rf vendor | ||
} | ||
trap cleanup EXIT | ||
|
||
trap "exit 1" ERR | ||
|
||
az login | ||
az keyvault secret download --file CLIEVCodeSigningCertificate2.pfx --name CLIEVCodeSigningCertificate2 --subscription cc-prod --vault-name CLICodeSigningKeyVault --encoding base64 | ||
|
||
go mod vendor | ||
|
||
# Build windows/amd64 | ||
docker build . --file ./docker/Dockerfile_windows_amd64 --tag cli-windows-amd64-builder-image --secret id=CLIEVCodeSigningCertificate2.pfx,src=CLIEVCodeSigningCertificate2.pfx | ||
docker container create --name cli-windows-amd64-builder cli-windows-amd64-builder-image | ||
docker container cp cli-windows-amd64-builder:/cli/prebuilt/. ./prebuilt/ | ||
docker container rm cli-windows-amd64-builder |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not the end of the world if we don't do this since the CI machines get reset between runs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, but I'm writing this so far on the assumption that we might be releasing before we fully switch to the CI.