Commit 7af5c7c6 authored by Muhammad Usman's avatar Muhammad Usman

Update .gitlab-ci.yml

parent 20da54b1
Pipeline #2422 failed with stages
in 6 minutes and 42 seconds
.cache:
cache:
key: ${CI_COMMIT_REF_SLUG}
policy: pull
paths:
- target/java-maven-app-1.1.0-SNAPSHOT.jar
stages:
- install
- build
- deploy
maven-job:
stage: install
extends: .cache
image: maven:3-jdk-11
script:
- mvn clean package
- mvn package
cache:
policy: push
docker-build-job:
stage: build
image: docker:latest
extends: .cache
image: docker:20.10.10
before_script:
- echo $DOCKER_REGISTRY_PASS | docker login -u $DOCKER_REGISTRY_USER --password-stdin
script:
- docker build -t nisum-cicd-task:latest
\ No newline at end of file
- docker build -t usmanbaloch/nisum-cicd-task:latest .
- docker push usmanbaloch/nisum-cicd-task:latest
services:
- docker:20.10.10-dind
deploy-on-k8s:
stage: deploy
image: google/cloud-sdk
script:
# Authenticate with GKE
- echo "$SERVICE_ACCOUNT_KEY" > key.json
- gcloud auth activate-service-account --key-file=key.json
- gcloud config set project $GCP_PROJECT_NAME
- gcloud config set container/cluster $GKE_CLUSTER_NAME
- gcloud config set compute/zone $GKE_CLUSTER_ZONE
- gcloud container clusters get-credentials $GKE_CLUSTER_NAME --zone $GKE_CLUSTER_ZONE --project $GCP_PROJECT_NAME
# - sed -i "s/<VERSION>/${CI_COMMIT_SHORT_SHA}/g" deployment.yaml
- kubectl apply -f dep-nisum-cicd.yaml
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment