forked from oracle-quickstart/appstack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-artifact.yaml.template
55 lines (55 loc) · 2.03 KB
/
build-artifact.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
# 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 based on an artifact
version: 0.1
component: build
timeoutInSeconds: 10000
shell: bash
env:
vaultVariables:
OCI_TOKEN : "${oci_token}"
DB_USER_PASSWORD : "${db_user_password}"
WALLET_PASSWORD : "${wallet_password}"
inputArtifacts:
- name: javaapp
type: GENERIC_ARTIFACT
artifactId: ${artifactId}
registryId: ${registryId}
path: "javaapp"
version: "0.0.1"
location: $${OCI_WORKSPACE_DIR}/${config_repo_name}/${fileName}
steps:
- type: Command
name: Unzip wallet
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: 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}