Compare commits
No commits in common. "stable" and "feat/automation" have entirely different histories.
stable
...
feat/autom
25
Jenkinsfile
vendored
25
Jenkinsfile
vendored
@ -1,25 +0,0 @@
|
||||
// Intégration de la librairie Cadoles (voir https://forge.cadoles.com/Cadoles/Jenkins)
|
||||
@Library("cadoles") _
|
||||
|
||||
// Utilisation du pipeline partagé pour les applications Symfony de Cadoles
|
||||
// Le nom de l'image Docker passée en paramètre vous permet de préciser l'environnement de test
|
||||
// de votre application Symfony
|
||||
symfonyAppPipeline('ubuntu:22.04', [
|
||||
'hooks': [
|
||||
// Run docker image build, verification and publication stages
|
||||
'postSymfonyAppPipeline': {
|
||||
stage('Build and publish docker images') {
|
||||
// Retrieve current tag
|
||||
String currentTag = sh(script: 'git tag --points-at HEAD | head -n 1', returnStdout: true).trim()
|
||||
// Retrieve default tag
|
||||
String defaultTag = sh(returnStdout: true, script: 'git describe --always').trim()
|
||||
kubecontainer.buildAndPublishImage([
|
||||
'imageName': 'reg.cadoles.com/pcaseiro/myapplication-standalone',
|
||||
'imageTag': defaultTag,
|
||||
'dockerfile': './misc/images/myapplication-standalone/Dockerfile',
|
||||
'dryRun': false
|
||||
])
|
||||
}
|
||||
}
|
||||
]
|
||||
])
|
14
Makefile
14
Makefile
@ -1,12 +1,10 @@
|
||||
##################################################
|
||||
# Makefile for Cadoles Kubernetes Skeletor project
|
||||
##################################################
|
||||
################################
|
||||
# Makefile for Cadoles SP
|
||||
################################
|
||||
|
||||
COMMIT_ID ?= $(shell git rev-parse --short --verify HEAD)
|
||||
CURRENT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD | tr -c '[:alnum:]\n\r' '_'| tr '[:upper:]' '[:lower:]')
|
||||
|
||||
IMAGE_REPO ?= reg.cadoles.com/cadoles
|
||||
IMAGE_VERSION ?= 0.0.1-$(CURRENT_BRANCH)
|
||||
IMAGE_REPO := reg.cadoles.com/cadoles
|
||||
IMAGE_VERSION ?= 0.0.1
|
||||
|
||||
DAY_SUFFIX_TAG ?= $(shell date +%Y%m%d)
|
||||
|
||||
include main.mk
|
||||
|
19
init-app
19
init-app
@ -73,33 +73,32 @@ init_app() {
|
||||
return 2
|
||||
fi
|
||||
|
||||
git clone ${SKELL_GIT_URL} ${appDest}
|
||||
git clone --branch "feat/automation" ${SKELL_GIT_URL} ${appDest}
|
||||
|
||||
cd ${appDest}
|
||||
rm -rf .git
|
||||
rm -rf init-app
|
||||
|
||||
echo "Setting Dockerfiles"
|
||||
dirs=$(find ${DOCKERFILES_ROOT}/* -type d -name 'myapplication-*')
|
||||
dirs=$(find ${DOCKERFILES_ROOT}/* -type d -name 'MYAPPLICATION-*')
|
||||
for d in ${dirs}; do
|
||||
mv ${d} $(echo ${d} | sed "s/myapplication/${appName}/g")
|
||||
mv ${d} $(echo ${d} | sed "s/MYAPPLICATION/${appName}/g")
|
||||
done
|
||||
echo "Setting Kustomization directories"
|
||||
dirs=$(find ${KUSTOMIZE_DIR}/* -type d -name 'myapplication-*')
|
||||
dirs=$(find ${KUSTOMIZE_DIR}/* -type d -name 'MYAPPLICATION-*')
|
||||
for d in ${dirs}; do
|
||||
mv ${d} $(echo ${d} | sed "s/myapplication/${appName}/g")
|
||||
mv ${d} $(echo ${d} | sed "s/MYAPPLICATION/${appName}/g")
|
||||
done
|
||||
|
||||
echo "Setting Kustomization files"
|
||||
dirs=$(find ${KUSTOMIZE_DIR}/* -type f -name 'myapplication-*')
|
||||
dirs=$(find ${KUSTOMIZE_DIR}/* -type f -name 'MYAPPLICATION-*')
|
||||
for d in ${dirs}; do
|
||||
mv ${d} $(echo ${d} | sed "s/myapplication/${appName}/g")
|
||||
mv ${d} $(echo ${d} | sed "s/MYAPPLICATION/${appName}/g")
|
||||
done
|
||||
|
||||
grep -rl "myapplication" ${KUSTOMIZE_DIR} | xargs sed -i "s/myapplication/${appName}/g"
|
||||
grep -rl "MYAPPLICATION" ${KUSTOMIZE_DIR} | xargs sed -i "s/MYAPPLICATION/${appName}/g"
|
||||
|
||||
echo "Setting Skaffold configuration"
|
||||
sed -i "s/myapplication/${appName}/g" ${appDest}/skaffold.yaml
|
||||
sed -i "s/MYAPPLICATION/${appName}/g" ${appDest}/skaffold.yaml
|
||||
|
||||
echo "Setting docker registry secrets"
|
||||
create_docker_secret ${conf}
|
||||
|
13
main.mk
13
main.mk
@ -28,12 +28,12 @@ define install_trivy
|
||||
endef
|
||||
|
||||
define release_image
|
||||
docker tag $(IMAGE_REPO)/$1:$(IMAGE_VERSION) $(IMAGE_REPO)/$1:$(IMAGE_VERSION)-$(COMMIT_ID) ; \
|
||||
docker tag $(IMAGE_REPO)/$1:$(IMAGE_VERSION) $(IMAGE_REPO)/$1:$(IMAGE_VERSION)-$(DAY_SUFFIX_TAG) ; \
|
||||
docker tag $(IMAGE_REPO)/$1:$(IMAGE_VERSION) $(IMAGE_REPO)/$1:$(IMAGE_VERSION); \
|
||||
docker tag $(IMAGE_REPO)/$1:$(IMAGE_VERSION) $(IMAGE_REPO)/$1:$(IMAGE_VERSION)-latest; \
|
||||
docker push $(IMAGE_REPO)/$1:$(IMAGE_VERSION)-latest ; \
|
||||
docker tag $(IMAGE_REPO)/$1:$(IMAGE_VERSION) $(IMAGE_REPO)/$1:latest ; \
|
||||
docker push $(IMAGE_REPO)/$1:latest ; \
|
||||
docker push $(IMAGE_REPO)/$1:$(IMAGE_VERSION) ; \
|
||||
docker push $(IMAGE_REPO)/$1:$(IMAGE_VERSION)-$(COMMIT_ID)
|
||||
docker push $(IMAGE_REPO)/$1:$(IMAGE_VERSION)-$(DAY_SUFFIX_TAG)
|
||||
endef
|
||||
|
||||
#list:
|
||||
@ -57,12 +57,9 @@ release: ${IMAGES_DIR}/*
|
||||
@for name in $(basename $(notdir $^)); do \
|
||||
$(call release_image,$${name},base); \
|
||||
done;\
|
||||
git tag -f -a $(IMAGE_VERSION) -m "Version $(IMAGE_VERSION) released"; \
|
||||
git tag -f -a $(IMAGE_VERSION)-$(COMMIT_ID) -m "Version $(IMAGE_VERSION)-$(COMMIT_ID) released"; \
|
||||
git tag -f -a $(IMAGE_VERSION)-latest -m "Version $(IMAGE_VERSION)-latest released"; \
|
||||
|
||||
_release:
|
||||
docker tag $(IMAGE_FULL_NAME):$(IMAGE_TAG) $(IMAGE_FULL_NAME):$(IMAGE_TAG)-$(IMAGE_VERSION)-$(COMMIT_ID)
|
||||
docker tag $(IMAGE_FULL_NAME):$(IMAGE_TAG) $(IMAGE_FULL_NAME):$(IMAGE_TAG)-$(IMAGE_VERSION)-$(DAY_SUFFIX_TAG)
|
||||
docker tag $(IMAGE_FULL_NAME):$(IMAGE_TAG) $(IMAGE_FULL_NAME):$(IMAGE_TAG)-$(IMAGE_VERSION)
|
||||
docker tag $(IMAGE_FULL_NAME):$(IMAGE_TAG) $(IMAGE_FULL_NAME):$(IMAGE_TAG)-latest
|
||||
docker push $(IMAGE_FULL_NAME):$(IMAGE_TAG)-$(IMAGE_VERSION)-$(DAY_SUFFIX_TAG)
|
||||
|
@ -8,24 +8,24 @@ configurations:
|
||||
- ./configurations/cnpg-cluster.yaml
|
||||
|
||||
resources:
|
||||
- ./resources/myapplication-cnpg-cluster.yaml
|
||||
- ./resources/MYAPPLICATION-cnpg-cluster.yaml
|
||||
|
||||
secretgenerator:
|
||||
- name: myapplication-postgres-admin
|
||||
- name: MYAPPLICATION-postgres-admin
|
||||
type: secret
|
||||
literals:
|
||||
- username=postgres
|
||||
- password=notsosecret
|
||||
- name: myapplication-postgres-user
|
||||
- name: MYAPPLICATION-postgres-user
|
||||
type: Secret
|
||||
literals:
|
||||
- username=myapplication
|
||||
- username=MYAPPLICATION
|
||||
- password=NotSoSecretButThisIsBad
|
||||
|
||||
vars:
|
||||
- name: myapplication_DATABASE_SERVICE_NAME
|
||||
- name: MYAPPLICATION_DATABASE_SERVICE_NAME
|
||||
objref:
|
||||
name: myapplication-postgres
|
||||
name: MYAPPLICATION-postgres
|
||||
kind: Cluster
|
||||
apiVersion: postgresql.cnpg.io/v1
|
||||
fieldref:
|
@ -1,17 +1,17 @@
|
||||
apiVersion: postgresql.cnpg.io/v1
|
||||
kind: Cluster
|
||||
metadata:
|
||||
name: myapplication-postgres
|
||||
name: MYAPPLICATION-postgres
|
||||
spec:
|
||||
instances: 3
|
||||
primaryUpdateStrategy: unsupervised
|
||||
superuserSecret:
|
||||
name: myapplication-postgres-admin
|
||||
name: MYAPPLICATION-postgres-admin
|
||||
bootstrap:
|
||||
initdb:
|
||||
database: myapplication
|
||||
owner: myapplication
|
||||
database: MYAPPLICATION
|
||||
owner: MYAPPLICATION
|
||||
secret:
|
||||
name: myapplication-postgres-user
|
||||
name: MYAPPLICATION-postgres-user
|
||||
storage:
|
||||
size: 20Gi
|
@ -1,10 +1,10 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
namePrefix: myapplication-
|
||||
namePrefix: MYAPPLICATION-
|
||||
|
||||
components:
|
||||
- components/myapplication-cnpg
|
||||
- components/MYAPPLICATION-cnpg
|
||||
|
||||
resources:
|
||||
- resources/myapplication-kube
|
||||
- resources/MYAPPLICATION-kube
|
||||
|
@ -0,0 +1,6 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
resources:
|
||||
- ./resources/MYAPPLICATION-service.yaml
|
||||
- ./resources/MYAPPLICATION-deployment.yaml
|
@ -2,26 +2,26 @@ apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
io.kompose.service: myapplication
|
||||
name: myapplication
|
||||
io.kompose.service: MYAPPLICATION
|
||||
name: MYAPPLICATION
|
||||
spec:
|
||||
replicas: 3
|
||||
|
||||
selector:
|
||||
matchLabels:
|
||||
io.kompose.service: myapplication
|
||||
io.kompose.service: MYAPPLICATION
|
||||
strategy:
|
||||
type: Recreate
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
io.kompose.service: myapplication
|
||||
io.kompose.service: MYAPPLICATION
|
||||
spec:
|
||||
restartPolicy: Always
|
||||
containers:
|
||||
- image: reg.cadoles.com/cadoles/myapplication-kube
|
||||
- image: reg.cadoles.com/cadoles/MYAPPLICATION-kube
|
||||
imagePullPolicy: Always
|
||||
name: myapplication-php-fpm
|
||||
name: MYAPPLICATION-php-fpm
|
||||
args: ["/usr/sbin/php-fpm81", "-F", "-e"]
|
||||
resources: {}
|
||||
env:
|
||||
@ -33,22 +33,22 @@ spec:
|
||||
value: 128m
|
||||
- name: PHP_FPM_LOG_LEVEL
|
||||
value: warning
|
||||
- name: myapplication_DATABASE_SERVICE_NAME
|
||||
value: $(myapplication_DATABASE_SERVICE_NAME)-rw
|
||||
- image: reg.cadoles.com/cadoles/myapplication-kube
|
||||
- name: MYAPPLICATION_DATABASE_SERVICE_NAME
|
||||
value: $(MYAPPLICATION_DATABASE_SERVICE_NAME)-rw
|
||||
- image: reg.cadoles.com/cadoles/MYAPPLICATION-kube
|
||||
imagePullPolicy: Always
|
||||
name: myapplication-nginx
|
||||
name: MYAPPLICATION-nginx
|
||||
args: ["/usr/sbin/nginx"]
|
||||
env:
|
||||
- name: NGINX_APP_UPSTREAM_BACKEND_SERVER
|
||||
- name: NGINX_MYAPPLICATION_UPSTREAM_BACKEND_SERVER
|
||||
value: 127.0.0.1:9000
|
||||
- name: NGINX_APP_ROOT
|
||||
- name: NGINX_MYAPPLICATION_ROOT
|
||||
value: "/public"
|
||||
- name: NGINX_APP_PHP_INDEX
|
||||
- name: NGINX_MYAPPLICATION_PHP_INDEX
|
||||
value: "/index.php"
|
||||
- name: NGINX_ERROR_LOG_LEVEL
|
||||
value: "warn"
|
||||
- name: NGINX_APP_PHP_NON_FILE_PATTERN
|
||||
- name: NGINX_MYAPPLICATION_PHP_NON_FILE_PATTERN
|
||||
value: "^/index\\.php(/|$)"
|
||||
ports:
|
||||
- containerPort: 8080
|
@ -2,13 +2,13 @@ apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
io.kompose.service: myapplication
|
||||
name: myapplication
|
||||
io.kompose.service: MYAPPLICATION
|
||||
name: MYAPPLICATION
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- name: myapplication-http
|
||||
- name: MYAPPLICATION-http
|
||||
port: 80
|
||||
targetPort: 8080
|
||||
selector:
|
||||
io.kompose.service: myapplication
|
||||
io.kompose.service: MYAPPLICATION
|
@ -1,6 +0,0 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
resources:
|
||||
- ./resources/myapplication-service.yaml
|
||||
- ./resources/myapplication-deployment.yaml
|
@ -1,6 +1,6 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namespace: myapplication-dev
|
||||
namespace: MYAPPLICATION-dev
|
||||
|
||||
resources:
|
||||
- ../../base
|
||||
@ -8,7 +8,7 @@ resources:
|
||||
- resources/ingress.yaml
|
||||
|
||||
patches:
|
||||
- path: patches/myapplication-update-replicas.yaml
|
||||
- path: patches/MYAPPLICATION-update-replicas.yaml
|
||||
- path: patches/add-registry-pull-secret.yaml
|
||||
target:
|
||||
kind: Deployment
|
||||
|
@ -2,7 +2,7 @@ apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
io.kompose.service: myapplication
|
||||
name: myapplication
|
||||
io.kompose.service: MYAPPLICATION
|
||||
name: MYAPPLICATION
|
||||
spec:
|
||||
replicas: 1
|
@ -1,7 +1,7 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: myapplication
|
||||
name: MYAPPLICATION
|
||||
annotations:
|
||||
nginx.ingress.kubernetes.io/proxy-body-size: "138m"
|
||||
nginx.ingress.kubernetes.io/enable-cors: "true" #cf 01
|
||||
@ -9,13 +9,13 @@ metadata:
|
||||
spec:
|
||||
ingressClassName: nginx
|
||||
rules:
|
||||
- host: myapplication.dev.local
|
||||
- host: MYAPPLICATION.dev.local
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: myapplication
|
||||
name: MYAPPLICATION
|
||||
port:
|
||||
number: 80
|
||||
number: 8080
|
||||
|
@ -1,4 +1,4 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: myapplication-dev
|
||||
name: MYAPPLICATION-dev
|
||||
|
@ -29,7 +29,7 @@ build:
|
||||
sha256: {}
|
||||
|
||||
artifacts:
|
||||
- image: reg.cadoles.com/cadoles/myapplication-kube
|
||||
- image: reg.cadoles.com/cadoles/MYAPPLICATION-kube
|
||||
context: .
|
||||
sync:
|
||||
infer:
|
||||
@ -41,7 +41,7 @@ build:
|
||||
- composer.json
|
||||
- composer.lock
|
||||
kaniko:
|
||||
dockerfile: misc/images/myapplication-kube/Dockerfile
|
||||
dockerfile: misc/images/MYAPPLICATION-kube/Dockerfile
|
||||
cache: {}
|
||||
|
||||
deploy:
|
||||
|
Loading…
Reference in New Issue
Block a user