forked from JasonHaley/hello-python
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild_spec.yaml
More file actions
62 lines (58 loc) · 1.64 KB
/
Copy pathbuild_spec.yaml
File metadata and controls
62 lines (58 loc) · 1.64 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
version: 0.1
component: build
timeoutInSeconds: 6000
shell: bash
# Variables
env:
exportedVariables:
- TAG_VERSION
- COMMIT
vaultVariables:
docker_registry_password : ocid1.vaultsecret.oc1.phx.amaaaaaayat6pyaacvggvlf6hmbgqguquempfl73xfo7fce5r4tiqh5ulgjq
inputArtifacts:
steps:
- type: Command
name: "Export image tag"
timeoutInSeconds: 400
command: |
export TAG_VERSION=`echo ${OCI_BUILD_RUN_ID} | tail -c 8`
- type: Command
name: "Export commit tag"
timeoutInSeconds: 200
command: |
export COMMIT=`git rev-parse --short HEAD`
- type: Command
name: "Echo Variables"
command: |
echo "TAG_VERSION = " $TAG_VERSION
echo "COMMIT = " $COMMIT
- type: Command
timeoutInSeconds: 400
name: "Docker Build"
command: |
docker build -t danberg/hello-py -f Dockerfile .
docker tag danberg/hello-py:latest danberg/hello-py:$TAG_VERSION
onFailure:
- type: Command
command: |
echo "Handling image build failure"
build_result=FAILURE
echo "Image build failure successfully handled"
timeoutInSeconds: 400
- type: Command
timeoutInSeconds: 600
name: "Log into Dockerhub"
command: |
docker login -u "danberg" -p ${docker_registry_password}
- type: Command
timeoutInSeconds: 400
name: "Push image to Dockerhub with proper tag"
command: |
docker push danberg/hello-py:$TAG_VERSION
outputArtifacts:
- name: deployment-manifest
type: BINARY
location: ${OCI_PRIMARY_SOURCE_DIR}/kubernetes/deployment_oke.yaml
- name: hello-image
type: DOCKER_IMAGE
location: danberg/hello-py