forked from AdanRuiz/oci-react-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_spec.yaml
93 lines (84 loc) · 2.93 KB
/
build_spec.yaml
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
version: 0.1
component: build
timeoutInSeconds: 1000
shell: bash
failImmediatelyOnError: true
env:
variables:
"testEnv" : "testValue1"
"JAVA_HOME" : "/usr/lib64/graalvm/graalvm20-ee-java11"
exportedVariables:
- BuildServiceDemoVersion
steps:
- type: Command
name: Setup environment
command: |
yum -y install curl
yum -y install graalvm20-ee-11-native-image
ls /usr/lib64/graalvm
export JAVA_HOME=/usr/lib64/graalvm/graalvm20-ee-java11
echo "JAVA_HOME: "
echo $JAVA_HOME
ls -la
pwd
- type: Command
name: "Set the PATH here"
command: |
export JAVA_HOME=/usr/lib64/graalvm/graalvm20-ee-java11
export PATH=$JAVA_HOME/bin:$PATH
echo "JAVA_HOME: "
echo $JAVA_HOME
echo "PATH: "
echo $PATH
echo "Java -version: "
java -version
echo "Javac -version: "
javac -version
- type: Command
name: Package
command: |
export JAVA_HOME=/usr/lib64/graalvm/graalvm20-ee-java11
echo "Java -version: "
java -version
echo "Javac -version: "
javac -version
cd MtdrSpring/backend
mvn clean package spring-boot:repackage
- type: Command
name: Check target
command: ls -la MtdrSpring/backend/target/
- type: Command
name: Dockerize
command: |
BuildServiceDemoVersion=`echo ${OCI_BUILD_RUN_ID} | rev | cut -c 1-7`
echo "BuildServiceDemoVersion: "
echo $BuildServiceDemoVersion
cd MtdrSpring/backend
docker build -f Dockerfile --platform=linux/arm64 -t mx.queretaro-1.ocir.io/ax2dp0evxata/oci_java_bot_devops:${BuildServiceDemoVersion} .
- type: Command
name: Modify manifest
command: |
BuildServiceDemoVersion=`echo ${OCI_BUILD_RUN_ID} | rev | cut -c 1-7`
echo "BuildServiceDemoVersion: "
echo $BuildServiceDemoVersion
cd MtdrSpring/backend/src/main/resources
ls -la
cp todolistapp-springboot.yaml todolistapp-springboot.yaml.tmp &&
sed "s/BuildServiceDV/${BuildServiceDemoVersion}/g" <todolistapp-springboot.yaml.tmp >todolistapp-springboot.yaml &&
rm -f todolistapp-springboot.yaml.tmp
echo "MtdrSpring/backend/src/main/resources/todolistapp-springboot.yaml: "
cat todolistapp-springboot.yaml
cd ../../../target/classes
ls -la
cp todolistapp-springboot.yaml todolistapp-springboot.yaml.tmp &&
sed "s/BuildServiceDV/${BuildServiceDemoVersion}/g" <todolistapp-springboot.yaml.tmp >todolistapp-springboot.yaml &&
rm -f todolistapp-springboot.yaml.tmp
echo "MtdrSpring/backend/target/classes/todolistapp-springboot.yaml: "
cat todolistapp-springboot.yaml
outputArtifacts:
- name: javaBotDockerImage
type: DOCKER_IMAGE
location: mx.queretaro-1.ocir.io/ax2dp0evxata/oci_java_bot_devops:${BuildServiceDemoVersion}
- name: kube-manifest-build-service-demo
type: BINARY
location: MtdrSpring/backend/target/classes/todolistapp-springboot.yaml