Created pipeline for deploy, use .kube/config

This commit is contained in:
2023-11-04 23:13:25 +01:00
parent 35f993b530
commit 114a715285

View File

@@ -1,7 +1,7 @@
--- ---
kind: pipeline kind: pipeline
type: docker type: docker
name: Build and publish name: Build
platform: platform:
os: linux os: linux
@@ -40,25 +40,25 @@ steps:
branch: branch:
- main - main
---
kind: pipeline
type: docker
name: Deploy
platform:
os: linux
arch: amd64
steps:
- name: Deploy app to kubernetes - name: Deploy app to kubernetes
image: alpine/k8s:1.25.15 image: alpine/k8s:1.25.15
commands: commands:
- kubectl config set-cluster $KUBE_CLUSTER --server=$KUBE_SERVER - mkdir -p /root/.kube
- kubectl config set-credentials $KUBE_USER --token=$KUBE_TOKEN - echo $KUBE_CONFIG | base64 -di > /root/.kube/config
- kubectl config set-context $KUBE_CONTEXT --cluster=$KUBE_CLUSTER --user=$KUBE_USER - kubectl --kubeconfig=/root/.kube/config get pods
- kubectl config use-context $KUBE_CONTEXT
- kubectl get pods
environment: environment:
KUBE_CLUSTER: KUBE_CONFIG:
from_secret: KUBE_CLUSTER from_secret: KUBE_CONFIG
KUBE_USER:
from_secret: KUBE_USER
KUBE_SERVER:
from_secret: KUBE_SERVER
KUBE_TOKEN:
from_secret: KUBE_TOKEN
KUBE_CONTEXT:
from_secret: KUBE_CONTEXT
when: when:
event: event:
include: include:
@@ -68,3 +68,6 @@ steps:
branch: branch:
- main - main
- kube - kube
depends_on:
- Build