-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuildspec.yml
More file actions
47 lines (42 loc) · 1.49 KB
/
buildspec.yml
File metadata and controls
47 lines (42 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
version: 0.2
phases:
install:
commands:
- set -e
- echo "[install] check maven"
- if ! command -v mvn >/dev/null 2>&1; then yum -y install maven || (apt-get update && apt-get -y install maven); fi
- mvn -version || true
- java -version || true
pre_build:
commands:
- set -euo pipefail
- echo "[pre_build] verify pom.xml"
- '[ -f pom.xml ] || { echo "pom.xml not found"; ls -la; exit 1; }'
build:
commands:
- set -e
- echo "[build] mvn package (skip tests)"
- mvn -B -DskipTests clean package
post_build:
commands:
- set -e
- echo "[post_build] locate jar"
- JAR_PATH="$(ls -1 target/*.jar | grep -Ev '(-sources|-javadoc|-original)\.jar$' | head -n1 || true)"
- '[ -n "${JAR_PATH:-}" ] || { echo "JAR not found"; ls -la target || true; exit 1; }'
- echo "JAR_PATH=${JAR_PATH}"
- echo "[post_build] stage artifact/"
- rm -rf artifact && mkdir -p artifact/app artifact/app/public
- cp "${JAR_PATH}" artifact/app/app.jar
- cp appspec.yml artifact/
- cp -r scripts artifact/
- cp -r systemd artifact/
- printf '{"commit":"%s","builtAt":"%s"}' "$CODEBUILD_RESOLVED_SOURCE_VERSION" "$(date -u +%FT%TZ)" > artifact/app/public/build.json
- echo "==== artifact tree ====" && find artifact -maxdepth 3 -type f -print
artifacts:
base-directory: artifact
files:
- appspec.yml
- scripts/**/*
- systemd/**/*
- app/app.jar
- app/public/build.json