Skip to content

Commit e298cbd

Browse files
authored
Merge pull request #30 from softwareone-platform/azure-pipelines
MPT-13067: Added azure pipeline
2 parents ca4f358 + 08f15e2 commit e298cbd

File tree

21 files changed

+695
-4
lines changed

21 files changed

+695
-4
lines changed

azure-pipelines.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
trigger:
2+
- main
3+
- azure-pipelines
4+
5+
pool:
6+
name: "Standard-Linux"
7+
resources:
8+
repositories:
9+
- repository: templates
10+
type: git
11+
name: MPT/ops-build-templates-aks-releases
12+
ref: releases/v15
13+
14+
variables:
15+
- name: appName
16+
value: mpt-extension-finops
17+
18+
stages:
19+
- stage: prepare
20+
displayName: "Prerequisites"
21+
jobs:
22+
- template: aks-docker-templates/build_prerequisites.yaml@templates
23+
- template: aks-docker-templates/build_artifacts.yaml@templates
24+
parameters:
25+
application: $(appName)
26+
27+
- stage: build
28+
displayName: "Build"
29+
dependsOn: prepare
30+
variables:
31+
- template: aks-docker-templates/acr-creds-group.yaml@templates
32+
- group: swo.platform-build
33+
jobs:
34+
- job: build_image
35+
displayName: Build image
36+
variables:
37+
- name: buildVersion
38+
value: $[ stageDependencies.prepare.build_prerequisites.outputs['vars.BUILD_VERSION'] ]
39+
- name: majorVersion
40+
value: $[ split(variables.buildVersion, '.')[0] ]
41+
steps:
42+
- template: aks-docker-templates/docker-build-steps.yaml@templates
43+
parameters:
44+
repository: $(appName)
45+
sourceBuild: $(buildVersion)
46+
Dockerfile: prod.Dockerfile
47+
skipImagePush: ${{ eq(variables['Build.Reason'], 'PullRequest') }}
48+
49+
- job: BuildHelmChart
50+
displayName: Build Helm Chart
51+
variables:
52+
- template: aks-docker-templates/acr-creds-group.yaml@templates
53+
- name: buildVersion
54+
value: $[ stageDependencies.prepare.build_prerequisites.outputs['vars.BUILD_VERSION'] ]
55+
steps:
56+
- template: aks-docker-templates/helm-build-steps.yaml@templates
57+
parameters:
58+
buildNumber: $(buildVersion)
59+
repository: $(appName)
60+
workingDirectory: helm/$(appName)
61+
skipImagePush: ${{ eq(variables['Build.Reason'], 'PullRequest') }}
62+
63+
- stage: publish
64+
displayName: Publish
65+
dependsOn:
66+
- prepare
67+
- build
68+
jobs:
69+
- job: publish
70+
displayName: Publish
71+
# condition: or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Build.SourceBranch'], 'refs/heads/release/4'), eq(variables['System.Debug'], true))
72+
variables:
73+
- template: aks-docker-templates/acr-creds-group.yaml@templates
74+
- name: buildVersion
75+
value: $[ stageDependencies.prepare.build_prerequisites.outputs['vars.BUILD_VERSION'] ]
76+
steps:
77+
- template: aks-docker-templates/publish-steps.yaml@templates
78+
parameters:
79+
repository: $(appName)
80+
buildNumber: $(buildVersion)
81+
components: []
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v2
2+
name: mpt-extension-finops
3+
description: A Helm chart mpt-extension-finops owned by Sirius
4+
type: application
5+
6+
# Cli Version: 2.4.0
7+
8+
# This is the chart version. This version number should be incremented each time you make changes
9+
# to the chart and its templates, including the app version.
10+
version: 0.0.0
11+
12+
# This is the version number of the application being deployed. This version number should be
13+
# incremented each time you make changes to the application.
14+
appVersion: "0.0.0"
15+
cloudFormationTemplateVersion: "0.0.0"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj
22+
.vscode/
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: v2
2+
name: mpt-extension-finops-api
3+
description: A Helm chart mpt-extension-finops owned by Sirius
4+
type: application
5+
6+
# Cli Version: 2.4.0
7+
8+
# This is the chart version. This version number should be incremented each time you make changes
9+
# to the chart and its templates, including the app version.
10+
version: 0.0.0
11+
12+
# This is the version number of the application being deployed. This version number should be
13+
# incremented each time you make changes to the application.
14+
appVersion: "0.0.0"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
namespace: {{ .Release.Namespace }}
5+
name: {{ include "common.fullname" . }}
6+
labels:
7+
{{- include "common.labels" . | nindent 4 }}
8+
data:
9+
APPLICATIONINSIGHTS_CONNECTION_STRING: {{ .Values.global.AppInsightsConnectionString | quote }}
10+
OTEL_SERVICE_NAME: {{ .Values.global.OTELServiceName | quote }}
11+
MPT_PORTAL_BASE_URL: {{ .Values.global.MpPortalBaseUrl | quote }}
12+
MPT_API_BASE_URL: {{ .Values.global.MpBaseUrl | quote }}
13+
MPT_PRODUCTS_IDS: {{ .Values.global.MpProductsIds | quote }}
14+
MPT_NOTIFY_CATEGORIES: {{ .Values.global.MpNotifyCategories | quote }}
15+
EXT_EMAIL_NOTIFICATIONS_SENDER: {{ .Values.global.EmailNotificationsSender | quote }}
16+
EXT_EMAIL_NOTIFICATIONS_ENABLED: {{ .Values.global.EmailNotificationsEnabled | quote }}
17+
EXT_AWS_SES_REGION: {{ .Values.global.AwsSesRegion | quote }}
18+
EXT_FFC_SUB: {{ .Values.global.FFCSub | quote }}
19+
EXT_FFC_OPERATIONS_API_BASE_URL: {{ .Values.global.FFCOperationsBaseUrl | quote }}
20+
EXT_DEFAULT_BILLED_PERCENTAGE: {{ .Values.global.DefaultBilledPercentage | quote }}
21+
EXT_DEFAULT_TRIAL_PERIOD_DURATION_DAYS: {{ .Values.global.DefaultTrialPeriodDays | quote }}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
namespace: {{ .Release.Namespace }}
5+
name: {{ include "common.fullname" . }}
6+
labels:
7+
{{- include "common.labels" . | nindent 4 }}
8+
spec:
9+
replicas: {{ .Values.global.replicaCountAPI }}
10+
selector:
11+
matchLabels:
12+
{{- include "common.selectorLabels" . | nindent 6 }}
13+
template:
14+
metadata:
15+
labels:
16+
app.pyracloud.com/access-policy: {{.Values.accessPolicy}}
17+
app.pyracloud.com/access-policy-audience: {{.Values.accessPolicyAudience}}
18+
{{- include "common.labels" . | nindent 8 }}
19+
spec:
20+
containers:
21+
- name: main
22+
securityContext:
23+
{{- toYaml .Values.securityContext | nindent 12 }}
24+
image: "{{ .Values.global.registryUrl }}{{ .Values.image.repository }}:{{ .Chart.AppVersion }}"
25+
command:
26+
- swoext
27+
args:
28+
- run
29+
- api
30+
- --no-color
31+
- --reload
32+
imagePullPolicy: {{ .Values.image.pullPolicy }}
33+
envFrom:
34+
- configMapRef:
35+
name: ops-pyc-cluster-teamsetup-default-env-variables
36+
# - secretRef:
37+
# name: ops-pyc-cluster-teamsetup-pyra-xcluster-credentials
38+
- configMapRef:
39+
name: {{ include "common.fullname" . }}
40+
- secretRef:
41+
name: {{ include "common.fullname" . }}
42+
ports:
43+
- name: http
44+
containerPort: 80
45+
protocol: TCP
46+
- name: healthcheck
47+
containerPort: 8800
48+
protocol: TCP
49+
# livenessProbe:
50+
# httpGet:
51+
# path: /live
52+
# port: healthcheck
53+
# initialDelaySeconds: 15
54+
# periodSeconds: 30
55+
# timeoutSeconds: 5
56+
# readinessProbe:
57+
# httpGet:
58+
# path: /ready
59+
# port: healthcheck
60+
# initialDelaySeconds: 5
61+
# periodSeconds: 5
62+
# timeoutSeconds: 5
63+
resources:
64+
{{- toYaml .Values.resources | nindent 12 }}
65+
{{- with .Values.nodeSelector }}
66+
nodeSelector:
67+
{{- toYaml . | nindent 8 }}
68+
{{- end }}
69+
affinity:
70+
# Default affinity is set to ensure all pods are not located on the same node.
71+
podAntiAffinity:
72+
preferredDuringSchedulingIgnoredDuringExecution:
73+
- weight: 100
74+
podAffinityTerm:
75+
labelSelector:
76+
matchExpressions:
77+
- key: app.kubernetes.io/name
78+
operator: In
79+
values:
80+
- {{ include "common.name" . }}
81+
- key: app.kubernetes.io/instance
82+
operator: In
83+
values:
84+
- {{ .Release.Name }}
85+
topologyKey: "kubernetes.io/hostname"
86+
{{- with .Values.tolerations }}
87+
tolerations:
88+
{{- toYaml . | nindent 8 }}
89+
{{- end }}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{{- $root := . -}}
2+
{{- $serviceName := include "common.fullname" . -}}
3+
{{- $nameSufix := "core" -}}
4+
apiVersion: networking.istio.io/v1beta1
5+
kind: VirtualService
6+
metadata:
7+
namespace: {{ .Release.Namespace }}
8+
name: {{ $serviceName }}-{{ $nameSufix }}
9+
labels:
10+
{{- include "common.labels" . | nindent 4 }}
11+
spec:
12+
hosts:
13+
{{- toYaml .Values.ingress.hosts | nindent 4 }}
14+
gateways:
15+
{{- toYaml .Values.ingress.gateways | nindent 4 }}
16+
http:
17+
{{- range .Values.ingress.forward }}
18+
- match:
19+
- uri:
20+
prefix: {{ .match }}
21+
rewrite:
22+
uri: {{ .rewrite | quote }}
23+
route:
24+
- destination:
25+
host: {{ $serviceName | lower }}.{{ $root.Release.Namespace }}.svc.cluster.local
26+
port:
27+
number: 80
28+
timeout: 30s
29+
retries:
30+
attempts: 10
31+
#retryOn: connect-failure
32+
retryOn: 5xx,connect-failure # https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/router_filter#x-envoy-retry-on
33+
{{- end }}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
namespace: {{ .Release.Namespace }}
5+
name: {{ include "common.fullname" . }}
6+
labels:
7+
{{- include "common.labels" . | nindent 4 }}
8+
data:
9+
MPT_DJANGO_SECRET_KEY: {{ .Values.global.DjangoSecretKey }}
10+
MPT_API_TOKEN: {{ .Values.global.MpApiToken }}
11+
EXT_WEBHOOKS_SECRETS: {{ .Values.global.WebhookSecretKeys }}
12+
EXT_AWS_SES_CREDENTIALS: {{ .Values.global.AwsSesCredentials }}
13+
EXT_FFC_OPERATIONS_SECRET: {{ .Values.global.FFCOperationsToken }}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
namespace: {{ .Release.Namespace }}
5+
name: {{ include "common.fullname" . }}
6+
labels:
7+
{{- include "common.labels" . | nindent 4 }}
8+
spec:
9+
type: ClusterIP
10+
ports:
11+
- port: 80
12+
targetPort: 8080
13+
protocol: TCP
14+
name: http
15+
selector:
16+
{{- include "common.selectorLabels" . | nindent 4 }}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This is a YAML-formatted file.
2+
# Declare variables to be passed into your templates.
3+
4+
cliVersion: 2.4.0
5+
owner: turing
6+
git:
7+
repository: mpt-extension-finops
8+
image:
9+
repository: /mpt-extensions-finops
10+
pullPolicy: IfNotPresent
11+
12+
nameOverride: ""
13+
fullnameOverride: ""
14+
15+
podSecurityContext: {}
16+
# fsGroup: 2000
17+
18+
securityContext: {}
19+
20+
accessPolicy: public
21+
accessPolicyAudience: any
22+
# Type of app: test, product, infra
23+
type: product
24+
applicationGroup: pyra-cli
25+
26+
ingress:
27+
hosts:
28+
- customer-api.domain.global
29+
- extensions-api.domain.global
30+
gateways:
31+
- pyra/ops-pyc-cluster-gateway
32+
forward:
33+
- match: /mpt-extension-finops-api/
34+
rewrite: /
35+
36+
37+
resources: {}
38+
39+
40+
nodeSelector: {}
41+
42+
tolerations: []

0 commit comments

Comments
 (0)