Skip to content

Commit 91f9370

Browse files
authored
Fix release pipeline (#851)
**Issue:** The most recent release failed for 2 different reasons: 1) Many cross-compilation jobs failed, they all [use builder like this](https://github.com/awslabs/aws-crt-java/blob/ff164f25866afbcea64d61226904eb2ab420b348/codebuild/cd/generic-unix-build.sh#L31-L33) - failed while doing: `mv target/cmake-build/aws-crt-java/* target/cmake-build/` - error message: "target/cmake-build/deps already present" 2) The `aws-crt-java-manylinux-x64-fips` job failed with error "Could not find Go" **Description of changes:** 1) Fix 1st issue by doing `mv` on the 1 directory we care about, instead of doing `mv` on a wildcard where lots of stuff we don't care about can collide 2) Fix 2nd issue by installing golang via package manager - Previously, it was manually unpacking golang to a folder, and adding a relative path (`.go/go/bin`) to `$PATH` (which is weird usually you add absolute paths). And broke when the new "prebuild aws-lc" logic changed the working directory 3) Other small fixes
1 parent ff164f2 commit 91f9370

File tree

5 files changed

+38
-9
lines changed

5 files changed

+38
-9
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ if (BUILD_DEPS)
6868
list(APPEND AWSLC_CMAKE_ARGUMENTS -DFIPS=ON)
6969
list(APPEND AWSLC_CMAKE_ARGUMENTS -DDISABLE_PERL=OFF)
7070

71+
# Pick up GO_PATH env-var, set by aws-crt-builder when cross-compiling, see:
72+
# https://github.com/awslabs/aws-crt-builder/blob/31307c808ed9f2ea1eb16503b25a9b582f886481/builder/imports/golang.py#L84
73+
# https://github.com/awslabs/aws-crt-builder/blob/31307c808ed9f2ea1eb16503b25a9b582f886481/builder/actions/cmake.py#L110
7174
if (DEFINED ENV{GO_PATH})
7275
list(APPEND AWSLC_CMAKE_ARGUMENTS -DGO_EXECUTABLE=$ENV{GO_PATH}/go)
7376
message(STATUS "Overriding GO_EXECUTABLE to ${GO_EXECUTABLE}")

codebuild/cd/generic-unix-build.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,20 @@ chmod a+x builder
2929
GIT_TAG=$(git describe --tags)
3030

3131
./builder build -p aws-crt-java --target=$AWS_CRT_TARGET run_tests=false
32-
# Builder corss-compiles the shared lib to `target/cmake-build/aws-crt-java/`, move it to the expected path for mvn to generate the jar.
33-
mv target/cmake-build/aws-crt-java/* target/cmake-build/
32+
33+
# When cross-compiling with builder, the shared lib gets an extra "/aws-crt-java/" in its path.
34+
# Move it to expected location.
35+
if [ -d target/cmake-build/aws-crt-java/lib ]; then
36+
mv target/cmake-build/aws-crt-java/lib target/cmake-build/lib
37+
fi
38+
39+
# Double check that shared lib is where we expect
40+
if ! find target/cmake-build/lib -type f -name "*.so" | grep -q .; then
41+
echo "No .so files found"
42+
exit 1
43+
fi
3444

3545
JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 mvn -B package -DskipTests -Dshared-lib.skip=true -Dcrt.classifier=$CLASSIFIER
3646

37-
aws s3 cp --recursive --include "*.so" target/cmake-build/lib s3://aws-crt-java-pipeline/${GIT_TAG}/lib
47+
aws s3 cp --recursive --exclude "*" --include "*.so" target/cmake-build/lib s3://aws-crt-java-pipeline/${GIT_TAG}/lib
3848
aws s3 cp target/ s3://aws-crt-java-pipeline/${GIT_TAG}/jar/ --recursive --exclude "*" --include "aws-crt*.jar"

codebuild/cd/linux-aarch64-fips-build.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,19 @@ chmod a+x builder
1818
GIT_TAG=$(git describe --tags)
1919

2020
./builder build -p aws-crt-java run_tests=false --target=linux-arm64 --cmake-extra=-DCRT_FIPS=ON
21-
mv target/cmake-build/aws-crt-java/* target/cmake-build/
21+
22+
# When cross-compiling with builder, the shared lib gets an extra "/aws-crt-java/" in its path.
23+
# Move it to expected location.
24+
if [ -d target/cmake-build/aws-crt-java/lib ]; then
25+
mv target/cmake-build/aws-crt-java/lib target/cmake-build/lib
26+
fi
27+
28+
# Double check that shared lib is where we expect
29+
if ! find target/cmake-build/lib -type f -name "*.so" | grep -q .; then
30+
echo "No .so files found"
31+
exit 1
32+
fi
2233

2334
JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 mvn -B package -DskipTests -Dshared-lib.skip=true -Dcrt.classifier=linux-aarch_64-fips
2435

25-
aws s3 cp --recursive --include "*.so" target/cmake-build/lib s3://aws-crt-java-pipeline/${GIT_TAG}/fips_lib
36+
aws s3 cp --recursive --exclude "*" --include "*.so" target/cmake-build/lib s3://aws-crt-java-pipeline/${GIT_TAG}/fips_lib

codebuild/cd/manylinux-x64-fips-build.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ phases:
1111
- git submodule update --init
1212
# double check aws-lc is the FIPS approved branch.
1313
- bash ./codebuild/cd/test-fips-branch.sh
14-
- curl -OL https://go.dev/dl/go1.21.6.linux-amd64.tar.gz && mkdir ./go
15-
- tar -C ./go -xvf go1.21.6.linux-amd64.tar.gz
16-
- export PATH=$PATH:./go/go/bin
14+
# aws-lc FIPS build requires golang for codegen
15+
- yum install -y golang
1716
- mvn -B package -DskipTests -Dcrt.classifier=linux-x86_64-fips -Dcmake.crt_fips=ON
1817

1918
post_build:

codebuild/cd/musl-linux-build.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,11 @@ docker container prune -f
2323
# Upload the artifacts to S3
2424
export GIT_TAG=$(git describe --tags)
2525

26-
aws s3 cp --recursive --include "*.so" target/cmake-build/lib s3://aws-crt-java-pipeline/${GIT_TAG}/lib
26+
# Double check that shared lib is where we expect
27+
if ! find target/cmake-build/lib -type f -name "*.so" | grep -q .; then
28+
echo "No .so files found"
29+
exit 1
30+
fi
31+
32+
aws s3 cp --recursive --exclude "*" --include "*.so" target/cmake-build/lib s3://aws-crt-java-pipeline/${GIT_TAG}/lib
2733
aws s3 cp target/ s3://aws-crt-java-pipeline/${GIT_TAG}/jar/ --recursive --exclude "*" --include "aws-crt*.jar"

0 commit comments

Comments
 (0)