ajout pipeline test integration
This commit is contained in:
parent
64b5086ec8
commit
e4a9e09b36
2
Makefile
2
Makefile
@ -31,7 +31,7 @@ docker-secret:
|
||||
docker login reg.cadoles.com
|
||||
mkdir -p kustomization/base/tekton/secret/dockerconfig
|
||||
docker --config kustomization/base/tekton/secret/dockerconfig login reg.cadoles.com
|
||||
kubectl create secret generic regcred --from-file=config.json=kustomization/base/tekton/secret/dockerconfig/config.json -n tekton-pipelines
|
||||
kubectl create secret generic regcred --from-file=config.json=kustomization/base/tekton/secret/dockerconfig/config.json -n tekton
|
||||
kubectl patch cm feature-flags -n tekton-pipelines -p '{"data":{"enable-api-fields":"alpha"}}'
|
||||
|
||||
deploy-dev: ## Déploie le projet dans le cluster (nécessite la variable $HARBOR_USER_NAME)
|
||||
|
@ -1,6 +1,6 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namespace: tekton-pipelines
|
||||
namespace: tekton
|
||||
resources:
|
||||
- namespace/namespace.yaml
|
||||
- secret/git-secret.yaml
|
||||
@ -10,6 +10,8 @@ resources:
|
||||
- serviceaccount/rbac.yaml
|
||||
- configmap/configmap-phpcsfixer.yaml
|
||||
|
||||
- resources/
|
||||
|
||||
# Tasks
|
||||
- https://raw.githubusercontent.com/tektoncd/catalog/main/task/git-clone/0.9/git-clone.yaml
|
||||
- https://api.hub.tekton.dev/v1/resource/tekton/task/kaniko/0.6/raw
|
||||
@ -22,6 +24,7 @@ resources:
|
||||
- task/symfonyapp/phpsecuritycheck.yaml
|
||||
- task/symfonyapp/phpstan.yaml
|
||||
- task/symfonyapp/phpunittest.yaml
|
||||
- task/symfonyapp/phpfunctionaltest.yaml
|
||||
|
||||
# Pipelines
|
||||
- pipeline/imagebuild.yaml
|
||||
|
@ -1,4 +1,4 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: tekton-pipelines
|
||||
name: tekton
|
||||
|
@ -59,19 +59,19 @@ spec:
|
||||
- name: source
|
||||
workspace: shared-data
|
||||
|
||||
# ⭐ Exécution des tests phpstan
|
||||
- name: phpstan
|
||||
runAfter: ["gitclone"]
|
||||
taskRef:
|
||||
name: phpstan
|
||||
workspaces:
|
||||
- name: source
|
||||
workspace: shared-data
|
||||
params:
|
||||
- name: apiurl
|
||||
value: $(params.apiurl)
|
||||
- name: requestid
|
||||
value: $(params.requestid)
|
||||
# # ⭐ Exécution des tests phpstan
|
||||
# - name: phpstan
|
||||
# runAfter: ["gitclone"]
|
||||
# taskRef:
|
||||
# name: phpstan
|
||||
# workspaces:
|
||||
# - name: source
|
||||
# workspace: shared-data
|
||||
# params:
|
||||
# - name: apiurl
|
||||
# value: $(params.apiurl)
|
||||
# - name: requestid
|
||||
# value: $(params.requestid)
|
||||
|
||||
# ⭐ Exécution des tests php-cs-fixer
|
||||
- name: phpcsfixer
|
||||
@ -87,7 +87,7 @@ spec:
|
||||
- name: destination
|
||||
value: $(params.destination)
|
||||
|
||||
# ⭐ Execution des tests unitaires avec une BDD en sidecar
|
||||
# ⭐ Execution des tests unitaires et fonctionnels
|
||||
- name: phpunittest
|
||||
runAfter: ["gitclone"]
|
||||
taskRef:
|
||||
@ -97,62 +97,62 @@ spec:
|
||||
workspace: shared-data
|
||||
|
||||
finally:
|
||||
# 📨 Envoie du resulat de php-cs-fixer à gitea
|
||||
- name: phpcsfixer-giteacomment
|
||||
taskRef:
|
||||
name: giteacomment
|
||||
workspaces:
|
||||
- name: source
|
||||
workspace: shared-data
|
||||
- name: gitea-access-token
|
||||
workspace: gitea-access-token
|
||||
params:
|
||||
- name: apiurl
|
||||
value: $(params.apiurl)
|
||||
- name: requestid
|
||||
value: $(params.requestid)
|
||||
- name: title
|
||||
value: "PHP-CS-FIXER"
|
||||
- name: filepath
|
||||
value: "temp_phpcsfixer.txt"
|
||||
# # 📨 Envoie du resulat de php-cs-fixer à gitea
|
||||
# - name: phpcsfixer-giteacomment
|
||||
# taskRef:
|
||||
# name: giteacomment
|
||||
# workspaces:
|
||||
# - name: source
|
||||
# workspace: shared-data
|
||||
# - name: gitea-access-token
|
||||
# workspace: gitea-access-token
|
||||
# params:
|
||||
# - name: apiurl
|
||||
# value: $(params.apiurl)
|
||||
# - name: requestid
|
||||
# value: $(params.requestid)
|
||||
# - name: title
|
||||
# value: "PHP-CS-FIXER"
|
||||
# - name: filepath
|
||||
# value: "temp_phpcsfixer.txt"
|
||||
|
||||
# 📨 Envoi du resulat de phpstan à gitea
|
||||
- name: phpstan-giteacomment
|
||||
taskRef:
|
||||
name: giteacomment
|
||||
workspaces:
|
||||
- name: source
|
||||
workspace: shared-data
|
||||
- name: gitea-access-token
|
||||
workspace: gitea-access-token
|
||||
params:
|
||||
- name: apiurl
|
||||
value: $(params.apiurl)
|
||||
- name: requestid
|
||||
value: $(params.requestid)
|
||||
- name: title
|
||||
value: "PHPSTAN"
|
||||
- name: filepath
|
||||
value: "temp_phpstan.txt"
|
||||
# # 📨 Envoi du resulat de phpstan à gitea
|
||||
# - name: phpstan-giteacomment
|
||||
# taskRef:
|
||||
# name: giteacomment
|
||||
# workspaces:
|
||||
# - name: source
|
||||
# workspace: shared-data
|
||||
# - name: gitea-access-token
|
||||
# workspace: gitea-access-token
|
||||
# params:
|
||||
# - name: apiurl
|
||||
# value: $(params.apiurl)
|
||||
# - name: requestid
|
||||
# value: $(params.requestid)
|
||||
# - name: title
|
||||
# value: "PHPSTAN"
|
||||
# - name: filepath
|
||||
# value: "temp_phpstan.txt"
|
||||
|
||||
# 📨 Envoie le resulat de phpsecuritychecker à gitea
|
||||
- name: phpsecuritychecker-giteacomment
|
||||
taskRef:
|
||||
name: giteacomment
|
||||
workspaces:
|
||||
- name: source
|
||||
workspace: shared-data
|
||||
- name: gitea-access-token
|
||||
workspace: gitea-access-token
|
||||
params:
|
||||
- name: apiurl
|
||||
value: $(params.apiurl)
|
||||
- name: requestid
|
||||
value: $(params.requestid)
|
||||
- name: title
|
||||
value: "PHP-SECURITY-CHECK"
|
||||
- name: filepath
|
||||
value: "temp_phpsecuritychecker.txt"
|
||||
# # 📨 Envoie le resulat de phpsecuritychecker à gitea
|
||||
# - name: phpsecuritychecker-giteacomment
|
||||
# taskRef:
|
||||
# name: giteacomment
|
||||
# workspaces:
|
||||
# - name: source
|
||||
# workspace: shared-data
|
||||
# - name: gitea-access-token
|
||||
# workspace: gitea-access-token
|
||||
# params:
|
||||
# - name: apiurl
|
||||
# value: $(params.apiurl)
|
||||
# - name: requestid
|
||||
# value: $(params.requestid)
|
||||
# - name: title
|
||||
# value: "PHP-SECURITY-CHECK"
|
||||
# - name: filepath
|
||||
# value: "temp_phpsecuritychecker.txt"
|
||||
|
||||
# 🧹 Cleanup
|
||||
- name: cleanup-workspace
|
||||
|
5
kustomization/base/tekton/resources/kustomization.yaml
Normal file
5
kustomization/base/tekton/resources/kustomization.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
resources:
|
||||
- ./redis/redis-cluster.yaml
|
22
kustomization/base/tekton/resources/redis/redis-cluster.yaml
Normal file
22
kustomization/base/tekton/resources/redis/redis-cluster.yaml
Normal file
@ -0,0 +1,22 @@
|
||||
apiVersion: databases.spotahome.com/v1
|
||||
kind: RedisFailover
|
||||
metadata:
|
||||
name: tekton-redis
|
||||
spec:
|
||||
sentinel:
|
||||
replicas: 3
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
limits:
|
||||
memory: 100Mi
|
||||
redis:
|
||||
image: reg.cadoles.com/proxy_cache/library/redis:6.2.6-alpine
|
||||
replicas: 3
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 100Mi
|
||||
limits:
|
||||
cpu: 400m
|
||||
memory: 500Mi
|
@ -0,0 +1,70 @@
|
||||
apiVersion: tekton.dev/v1beta1
|
||||
kind: Task
|
||||
metadata:
|
||||
name: phpfunctionaltest
|
||||
spec:
|
||||
description: PHP functional test with bdd sidecar
|
||||
workspaces:
|
||||
- name: source
|
||||
sidecars:
|
||||
- name: database
|
||||
image: postgres:16
|
||||
env:
|
||||
- name: POSTGRES_PASSWORD
|
||||
value: not_so_secret
|
||||
- name: POSTGRES_HOST_AUTH_METHOD
|
||||
value: trust
|
||||
- name: redis
|
||||
image: redis:4.0
|
||||
|
||||
steps:
|
||||
- name: exec
|
||||
image: reg.cadoles.com/cadoles/symfony:alpine-php-7.4-base-20230926
|
||||
env:
|
||||
- name: PHP_FPM_MEMORY_LIMIT
|
||||
value: 512m
|
||||
- name: MSE_DATABASE_DRIVER
|
||||
value: pdo_pgsql
|
||||
- name: MSE_DATABASE_HOST
|
||||
value: localhost
|
||||
- name: MSE_DATABASE_PORT
|
||||
value: '5432'
|
||||
- name: MSE_DATABASE_NAME
|
||||
value: postgres
|
||||
- name: MSE_DATABASE_USER
|
||||
value: postgres
|
||||
- name: MSE_DATABASE_PASSWORD
|
||||
value: not_so_secret
|
||||
- name: MSE_REDIS_SERVER
|
||||
value: localhost
|
||||
- name: MSE_REDIS_PORT
|
||||
value: '6379'
|
||||
- name: MSE_REDIS_SERVER
|
||||
value: rfs-tekton-redis
|
||||
command:
|
||||
- /bin/sh
|
||||
args:
|
||||
- '-c'
|
||||
- |
|
||||
set -e
|
||||
apk add bash=5.1.16-r0 \
|
||||
postgresql-client \
|
||||
php7-gd=7.4.33-r1 \
|
||||
php7-xsl=7.4.33-r1 \
|
||||
php7-pdo=7.4.33-r1 \
|
||||
php7-pgsql=7.4.33-r1 \
|
||||
php7-pdo_pgsql=7.4.33-r1 \
|
||||
php7-soap=7.4.33-r1 \
|
||||
php7-ldap=7.4.33-r1 \
|
||||
php7-pdo_mysql=7.4.33-r1 \
|
||||
php7-bcmath=7.4.33-r1 \
|
||||
php7-intl=7.4.33-r1 \
|
||||
php7-fileinfo=7.4.33-r1 \
|
||||
php7-iconv=7.4.33-r1 \
|
||||
php7-pecl-amqp=1.11.0-r0 \
|
||||
php7-pecl-redis=5.3.6-r0
|
||||
cd $(workspaces.source.path)
|
||||
app/console doctrine:migrations:migrate -n
|
||||
./scripts/run-php-tests.sh --group integration --stderr --testdox -d memory_limit=512M
|
||||
|
||||
|
@ -3,7 +3,7 @@ kind: Task
|
||||
metadata:
|
||||
name: phpunittest
|
||||
spec:
|
||||
description: PHP unit test with bdd sidecar
|
||||
description: PHP unit test
|
||||
workspaces:
|
||||
- name: source
|
||||
sidecars:
|
||||
@ -14,11 +14,9 @@ spec:
|
||||
value: not_so_secret
|
||||
- name: POSTGRES_HOST_AUTH_METHOD
|
||||
value: trust
|
||||
- name: redis
|
||||
image: redis:4.0
|
||||
|
||||
steps:
|
||||
- name: exec
|
||||
- name: php-unit
|
||||
image: reg.cadoles.com/cadoles/symfony:alpine-php-7.4-base-20230926
|
||||
env:
|
||||
- name: PHP_FPM_MEMORY_LIMIT
|
||||
@ -61,8 +59,61 @@ spec:
|
||||
php7-iconv=7.4.33-r1 \
|
||||
php7-pecl-amqp=1.11.0-r0 \
|
||||
php7-pecl-redis=5.3.6-r0
|
||||
echo "memory_limit = 512M" >> /etc/php7/conf.d/03_base.ini
|
||||
echo "memory_limit = 512M" >> /etc/php8/conf.d/03_base.ini
|
||||
cd $(workspaces.source.path)
|
||||
app/console doctrine:migrations:migrate -n
|
||||
./scripts/run-php-tests.sh --group unit --stderr --testdox -d memory_limit=512M
|
||||
./bin/phpunit -c ./app --group unit --stderr --testdox -d memory_limit=1024M $(PHPUNIT_ARGS)
|
||||
onError: continue
|
||||
|
||||
- name: php-functional
|
||||
image: reg.cadoles.com/cadoles/symfony:alpine-php-7.4-base-20230926
|
||||
env:
|
||||
- name: PHP_FPM_MEMORY_LIMIT
|
||||
value: 512m
|
||||
- name: MSE_DATABASE_DRIVER
|
||||
value: pdo_pgsql
|
||||
- name: MSE_DATABASE_HOST
|
||||
value: localhost
|
||||
- name: MSE_DATABASE_PORT
|
||||
value: '5432'
|
||||
- name: MSE_DATABASE_NAME
|
||||
value: postgres
|
||||
- name: MSE_DATABASE_USER
|
||||
value: postgres
|
||||
- name: MSE_DATABASE_PASSWORD
|
||||
value: not_so_secret
|
||||
- name: MSE_REDIS_SERVER
|
||||
value: rfs-portal-redis
|
||||
- name: MSE_REDIS_PORT
|
||||
value: '26379'
|
||||
- name: MSE_REDIS_SERVER
|
||||
value: rfs-tekton-redis
|
||||
command:
|
||||
- /bin/sh
|
||||
args:
|
||||
- '-c'
|
||||
- |
|
||||
set -e
|
||||
apk add bash=5.1.16-r0 \
|
||||
postgresql-client \
|
||||
php7-gd=7.4.33-r1 \
|
||||
php7-xsl=7.4.33-r1 \
|
||||
php7-pdo=7.4.33-r1 \
|
||||
php7-pgsql=7.4.33-r1 \
|
||||
php7-pdo_pgsql=7.4.33-r1 \
|
||||
php7-soap=7.4.33-r1 \
|
||||
php7-ldap=7.4.33-r1 \
|
||||
php7-pdo_mysql=7.4.33-r1 \
|
||||
php7-bcmath=7.4.33-r1 \
|
||||
php7-intl=7.4.33-r1 \
|
||||
php7-fileinfo=7.4.33-r1 \
|
||||
php7-iconv=7.4.33-r1 \
|
||||
php7-pecl-amqp=1.11.0-r0 \
|
||||
php7-pecl-redis=5.3.6-r0
|
||||
echo "memory_limit = 512M" >> /etc/php7/conf.d/03_base.ini
|
||||
echo "memory_limit = 512M" >> /etc/php8/conf.d/03_base.ini
|
||||
cd $(workspaces.source.path)
|
||||
/bin/sh ./sidecar-scripts/init_database.sh
|
||||
./bin/phpunit -c ./app --group integration --stderr --testdox -d memory_limit=1024M $(PHPUNIT_ARGS)
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@ apiVersion: skaffold/v3
|
||||
kind: Config
|
||||
|
||||
metadata:
|
||||
name: tekton-pipelines
|
||||
name: tekton
|
||||
|
||||
manifests:
|
||||
kustomize:
|
||||
|
Loading…
x
Reference in New Issue
Block a user