forked from oracle-quickstart/appstack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-repo.yaml.template
81 lines (81 loc) · 2.7 KB
/
build-repo.yaml.template
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
# Copyright (c) 2023, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
# This workflow will build and push a Java application to OCI when a commit is
# pushed to your default branch.
version: 0.1
component: build
timeoutInSeconds: 3600
shell: bash
env:
variables:
JAVA_HOME : "/usr/java/latest"
vaultVariables:
OCI_TOKEN : "${oci_token}"
DB_USER_PASSWORD : "${db_user_password}"
WALLET_PASSWORD : "${wallet_password}"
steps:
- type: Command
name: Install Java
timeoutInSeconds: 600
failImmediatelyOnError: true
command: |
yum --enablerepo=ol7_oci_included clean metadata
yum install -y jdk-17
onFailure:
- type: Command
command: |
echo $JAVA_HOME
timeoutInSeconds: 400
- type: Command
name: Build application
timeoutInSeconds: 600
failImmediatelyOnError: true
command: |
cd $${OCI_WORKSPACE_DIR}/${repo_name}
${build_command}
onFailure:
- type: Command
command: |
pwd
timeoutInSeconds: 400
- type: Command
name: Create config files
timeoutInSeconds: 600
failImmediatelyOnError: true
command: |
cd $${OCI_WORKSPACE_DIR}/${config_repo_name}
unzip wallet.zip -d wallet
- type: Command
name: Download oraclepki and add username and password to wallet
timeoutInSeconds: 300
failImmediatelyOnError: true
command: |
cd $${OCI_WORKSPACE_DIR}/${config_repo_name}
curl -o oraclepki.jar "https://repo1.maven.org/maven2/com/oracle/database/security/oraclepki/23.2.0.0/oraclepki-23.2.0.0.jar" -L
echo -e '#/bin/sh\njava -cp oraclepki.jar oracle.security.pki.OracleSecretStoreTextUI -wrl wallet -createCredential "${db_connection_url}" "${db_username}" "'$${DB_USER_PASSWORD}'" <<EOF\n'$${WALLET_PASSWORD}'\nEOF' >> add-credential-wallet.sh
sh add-credential-wallet.sh
- type: Command
name: Get JAR file
timeoutInSeconds: 600
failImmediatelyOnError: true
command: |
cd $${OCI_WORKSPACE_DIR}/${config_repo_name}
cp $${OCI_WORKSPACE_DIR}/${repo_name}/${artifact_location} ./${fileName}
- type: Command
name: Build Docker image
timeoutInSeconds: 600
failImmediatelyOnError: true
command: |
docker build . --file Dockerfile --tag ${image_remote_tag}
- type: Command
name: Login to repo
timeoutInSeconds: 900
failImmediatelyOnError: true
command: |
echo $${OCI_TOKEN} | docker login ${container_registry_repo} --username ${login} --password-stdin
- type: Command
name: Push image
timeoutInSeconds: 600
failImmediatelyOnError: true
command: |
docker push ${image_remote_tag}