Skip to content

Commit

Permalink
feat: staging deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
pooriamehregan committed Oct 19, 2023
1 parent 74e066b commit 5390977
Show file tree
Hide file tree
Showing 8 changed files with 168 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2
updates:

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "sunday"

# Maintain dependencies for kotlin
- package-ecosystem: "maven"
directory: "/"
schedule:
interval: "weekly"
day: "sunday"
22 changes: 22 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Code scanning (CodeQL)

on:
pull_request:
types: [ready_for_review, opened, reopened, synchronize]
branches:
- main
push:
branches:
- main
schedule:
- cron: '0 2 * * *'

jobs:
codeql:
name: Run codeql scan
if: github.event.pull_request.draft == false
uses: Informasjonsforvaltning/workflows/.github/workflows/codeql.yaml@main
with:
language: java
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35 changes: 35 additions & 0 deletions .github/workflows/deploy-staging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Deploy to staging

on:
pull_request:
types: [ready_for_review, opened, reopened, synchronize]
branches:
- main

jobs:
build-service-catalog:
name: Build when pull request is created
if: github.event.pull_request.draft == false
uses: Informasjonsforvaltning/workflows/.github/workflows/build-push.yaml@main
with:
app_name: service-catalog
environment: staging
java_version: '17'
coverage_file_path: ./target/site/jacoco/jacoco.xml
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GCP_SA_DIGDIR_FDK_GCR_KEY: ${{ secrets.GCP_SA_DIGDIR_FDK_GCR_KEY }}

deploy:
name: Deploy to staging environment
if: github.event.pull_request.draft == false
needs: [ build-service-catalog ]
uses: Informasjonsforvaltning/workflows/.github/workflows/kustomize-deploy.yaml@main
with:
app_name: service-catalog
environment: staging
cluster: digdir-fdk-dev
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DIGDIR_FDK_AUTODEPLOY: ${{ secrets.DIGDIR_FDK_DEV_AUTODEPLOY }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
46 changes: 46 additions & 0 deletions deploy/base/deployment-service-catalog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: service-catalog
labels:
app: service-catalog
spec:
replicas: 1
selector:
matchLabels:
app: service-catalog
strategy:
type: RollingUpdate
template:
metadata:
labels:
app: service-catalog
annotations:
prometheus.io/scrape: "false"
spec:
containers:
- name: service-catalog
image: service-catalog
imagePullPolicy: Always
ports:
- containerPort: 8080
livenessProbe:
httpGet:
path: /actuator/health/liveness
port: 8080
initialDelaySeconds: 20
periodSeconds: 30
successThreshold: 1
failureThreshold: 5
readinessProbe:
httpGet:
path: /actuator/health/readiness
port: 8080
initialDelaySeconds: 20
periodSeconds: 30
successThreshold: 1
failureThreshold: 5
resources:
requests:
memory: 100Mi
10 changes: 10 additions & 0 deletions deploy/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment-service-catalog.yaml
- service-service-catalog.yaml
images:
- name: service-catalog
newName: eu.gcr.io/digdir-fdk-infra/service-catalog
newTag: $(GIT_COMMIT_SHA)
14 changes: 14 additions & 0 deletions deploy/base/service-service-catalog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
apiVersion: v1
kind: Service
metadata:
name: service-catalog
spec:
selector:
app: service-catalog
ports:
- name: http
protocol: TCP
port: 8080
targetPort: 8080
type: NodePort
18 changes: 18 additions & 0 deletions deploy/staging/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: service-catalog
spec:
ingressClassName: nginx
rules:
- host: service-catalog.api.staging.fellesdatakatalog.digdir.no
http:
paths:
- backend:
service:
name: service-catalog
port:
number: 8080
path: /
pathType: Prefix
7 changes: 7 additions & 0 deletions deploy/staging/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: staging
resources:
- ../base
- ingress.yaml

0 comments on commit 5390977

Please sign in to comment.