-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Epic: none Release note: None
- Loading branch information
Showing
6 changed files
with
112 additions
and
2 deletions.
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
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
48 changes: 48 additions & 0 deletions
48
build/teamcity/internal/release/build-and-publish-patched-go-fips.sh
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,48 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
google_credentials="$GOOGLE_EPHEMERAL_CREDENTIALS" | ||
dir="$(dirname $(dirname $(dirname $(dirname "${0}"))))" | ||
source "$dir/teamcity-support.sh" # for log_into_gcloud | ||
log_into_gcloud | ||
|
||
set -x | ||
|
||
this_dir="$(cd "$(dirname "${0}")"; pwd)" | ||
toplevel="$(dirname $(dirname $(dirname $(dirname $this_dir))))" | ||
|
||
mkdir -p "${toplevel}"/artifacts | ||
# TODO: pin docker image version | ||
DOCKER_IMAGE=registry.access.redhat.com/ubi8/go-toolset:latest | ||
|
||
tc_start_block "Build Go toolchains (linux/amd64)" | ||
docker run --rm -i ${tty-} -v $this_dir/build-and-publish-patched-go:/bootstrap \ | ||
-v "${toplevel}"/artifacts:/artifacts \ | ||
--user root \ | ||
--platform linux/amd64 \ | ||
$DOCKER_IMAGE /bootstrap/impl-fips.sh | ||
tc_end_block "Build Go toolchains (linux/amd64)" | ||
|
||
# TODO: do we care to cross build without the qemu llayer? Last I tried, th | ||
# compiler was complaining about some missing headers. | ||
tc_start_block "Build Go toolchains (linux/arm64)" | ||
docker run --rm -i ${tty-} -v $this_dir/build-and-publish-patched-go:/bootstrap \ | ||
-v "${toplevel}"/artifacts:/artifacts \ | ||
--user root \ | ||
--platform linux/arm64 \ | ||
$DOCKER_IMAGE /bootstrap/impl-fips.sh | ||
tc_end_block "Build Go toolchains (linux/arm64)" | ||
|
||
tc_start_block "Publish artifacts" | ||
loc=$(date +%Y%m%d-%H%M%S) | ||
for FILE in `find $root/artifacts -name '*.tar.gz'`; do | ||
BASE=$(basename $FILE) | ||
gsutil cp $FILE gs://public-bazel-artifacts/go-fips/$loc/$BASE | ||
done | ||
tc_end_block "Publish artifacts" | ||
|
||
tc_end_block "Print checksums" | ||
sha256sum $root/artifacts/*.tar.gz | ||
echo "urls = [\"https://storage.googleapis.com/public-bazel-artifacts/go-fips/$loc/{}\"]," | ||
tc_start_block "Print checksums" |
36 changes: 36 additions & 0 deletions
36
build/teamcity/internal/release/build-and-publish-patched-go/impl-fips.sh
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,36 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -xeuo pipefail | ||
|
||
# TODO: create a fork? | ||
GO_FIPS_REPO=https://github.com/golang-fips/go | ||
GO_FIPS_COMMIT=go1.19-fips-release | ||
|
||
|
||
# Install build dependencies | ||
yum install git golang golang-bin openssl openssl-devel -y | ||
cat /etc/os-release | ||
go version | ||
openssl version | ||
git config --global user.name "golang-fips ci" | ||
git config --global user.email "<>" | ||
|
||
mkdir /workspace | ||
cd /workspace | ||
git clone $GO_FIPS_REPO go | ||
cd go | ||
git checkout $GO_FIPS_COMMIT | ||
# Lower the requirements in case we need to bootstrap with an older Go version | ||
sed -i "s/go mod tidy/go mod tidy -go=1.16/g" scripts/create-secondary-patch.sh | ||
./scripts/full-initialize-repo.sh | ||
./scripts/configure-crypto-tests.sh | ||
cd go/src | ||
# Apply the CRL patch | ||
patch -p2 < /bootstrap/diff.patch | ||
./make.bash -v | ||
cd ../.. | ||
GOVERS=$(go/bin/go env GOVERSION) | ||
GOOS=$(go/bin/go env GOOS) | ||
GOARCH=$(go/bin/go env GOARCH) | ||
# Add the "-fips" suffix so we don't have the same basename with our regular Go toolchain. | ||
tar cf - go | gzip -9 > /artifacts/$GOVERS.$GOOS-$GOARCH-fips.tar.gz |
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