Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add build image and deploy #71

Merged
merged 3 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 62 additions & 21 deletions .tekton/pipeline.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
creationTimestamp: '2023-12-03T20:32:31Z'
generation: 2
managedFields:
- apiVersion: tekton.dev/v1
fieldsType: FieldsV1
fieldsV1:
'f:spec':
.: {}
'f:finally': {}
'f:params': {}
'f:tasks': {}
'f:workspaces': {}
manager: Mozilla
operation: Update
time: '2023-12-03T21:55:43Z'
name: cd-pipeline
# namespace: devops-products
resourceVersion: '1583706109'
uid: 6ffec68d-1efc-4ae2-9811-9815aae271fb
spec:
workspaces:
- name: pipeline-workspace

params:
- description: The URL to the git repo
name: GIT_REPO
Expand All @@ -29,6 +15,16 @@ spec:
description: The reference (branch or ref)
name: GIT_REF
type: string
- default: products
description: Name of the application
name: APP_NAME
type: string
- default: >-
image-registry.openshift-image-registry.svc:5000/$(context.pipelineRun.namespace)/$(params.APP_NAME):latest
description: The name of the image to build
name: IMAGE_NAME
type: string

tasks:
- name: git-clone
params:
Expand Down Expand Up @@ -71,7 +67,52 @@ spec:
workspaces:
- name: output
workspace: pipeline-workspace
workspaces:
- name: pipeline-workspace
optional: false
finally: []

- name: buildah
params:
- name: IMAGE
value: $(params.IMAGE_NAME)
- name: BUILDER_IMAGE
value: >-
registry.redhat.io/rhel8/buildah@sha256:00795fafdab9bbaa22cd29d1faa1a01e604e4884a2c935c1bf8e3d1f0ad1c084
- name: STORAGE_DRIVER
value: vfs
- name: DOCKERFILE
value: ./k8s/Dockerfile
- name: CONTEXT
value: .
- name: TLSVERIFY
value: 'true'
- name: FORMAT
value: oci
- name: BUILD_EXTRA_ARGS
value: ''
- name: PUSH_EXTRA_ARGS
value: ''
- name: SKIP_PUSH
value: 'false'
runAfter:
- git-clone
taskRef:
kind: ClusterTask
name: buildah
workspaces:
- name: source
workspace: pipeline-workspace

- name: deploy-image
params:
- name: old_image_name
value: 'cluster-registry:32000/products:latest'
- name: image_name
value: $(params.IMAGE_NAME)
- name: manifest_dir
value: k8s
runAfter:
- buildah
taskRef:
kind: Task
name: deploy-image
workspaces:
- name: source
workspace: pipeline-workspace
17 changes: 10 additions & 7 deletions k8s/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,19 @@ spec:
restartPolicy: Always
containers:
- name: products
image: docker.io/gorgeous/devops-23fall-products:20231127205915
# This image used in RedHat OpenShift
image: cluster-registry:32000/products:latest
# If you don't use ./tekton, use this image in other k8s
# image: docker.io/gorgeous/devops-23fall-products:20231127205915
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8000
- containerPort: 8000
env:
- name: DATABASE_URI
valueFrom:
secretKeyRef:
name: postgres-secret
key: database_uri
- name: DATABASE_URI
valueFrom:
secretKeyRef:
name: postgres-secret
key: database_uri
readinessProbe:
initialDelaySeconds: 5
periodSeconds: 20
Expand Down
6 changes: 6 additions & 0 deletions k8s/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,11 @@ green==3.4.3
factory-boy==3.2.1
coverage==7.1.0

# Behavior Driven Development
behave==1.2.6
selenium==4.10.0
compare==0.2b0
requests==2.31.0

# Utilities
httpie==3.2.1
Loading