doc et unit-test
This commit is contained in:
parent
b04135f9cc
commit
2c186f813c
4
Makefile
4
Makefile
@ -29,14 +29,14 @@ setup-cluster:
|
|||||||
kubectl apply -k kind/cluster/lb --server-side
|
kubectl apply -k kind/cluster/lb --server-side
|
||||||
|
|
||||||
ssh-secret:
|
ssh-secret:
|
||||||
cp kustomization/overlays/dev/resources/tekton/secret/secret.yaml.distkustomization/overlays/dev/resources/tekton/secret/secret.yaml
|
cp kustomization/base/tekton/secret/secret.yaml.dist kustomization/base/tekton/secret/secret.yaml
|
||||||
|
|
||||||
docker-secret:
|
docker-secret:
|
||||||
docker login reg.cadoles.com
|
docker login reg.cadoles.com
|
||||||
mkdir -p kustomization/base/tekton/secret/dockerconfig
|
mkdir -p kustomization/base/tekton/secret/dockerconfig
|
||||||
docker --config kustomization/base/tekton/secret/dockerconfig login reg.cadoles.com
|
docker --config kustomization/base/tekton/secret/dockerconfig login reg.cadoles.com
|
||||||
# mv kustomization/base/tekton/secret/dockerconfig/config.json kustomization/base/tekton/secret/dockerconfig/.dockerconfigjson
|
# mv kustomization/base/tekton/secret/dockerconfig/config.json kustomization/base/tekton/secret/dockerconfig/.dockerconfigjson
|
||||||
kubectl create secret generic regcred --from-file=config.json=kustomization/base/tekton/secret/dockerconfig/config.json
|
kubectl create secret generic regcred --from-file=config.json=kustomization/base/tekton/secret/dockerconfig/config.json -n tekton
|
||||||
|
|
||||||
deploy-dev: ## Déploie le projet dans le cluster (nécessite la variable $HARBOR_USER_NAME)
|
deploy-dev: ## Déploie le projet dans le cluster (nécessite la variable $HARBOR_USER_NAME)
|
||||||
skaffold dev -p dev --cleanup=false --default-repo reg.cadoles.com/${HARBOR_USER_NAME}
|
skaffold dev -p dev --cleanup=false --default-repo reg.cadoles.com/${HARBOR_USER_NAME}
|
||||||
|
18
README.md
18
README.md
@ -2,14 +2,22 @@
|
|||||||
|
|
||||||
CI du projet MSE
|
CI du projet MSE
|
||||||
|
|
||||||
|
|
||||||
[Documentation](doc/tekton.md)
|
|
||||||
|
|
||||||
|
|
||||||
### Lancement de l'environnement
|
### Lancement de l'environnement
|
||||||
|
|
||||||
|
Lancer l'environnement
|
||||||
|
|
||||||
```
|
```
|
||||||
make create-cluster
|
make create-cluster
|
||||||
|
|
||||||
skaffold dev
|
skaffold dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Préparer les secrets
|
||||||
|
```
|
||||||
|
make ssh-secret
|
||||||
|
make docker-secret
|
||||||
|
```
|
||||||
|
Editer le fichier `kustomization/base/tekton/secret/secret.yaml` avec les identifiants git
|
||||||
|
|
||||||
|
|
||||||
|
### Lancement d'un pipeline
|
||||||
|
[Documentation](doc/tekton.md)
|
||||||
|
@ -9,6 +9,9 @@ spec:
|
|||||||
- name: repo-url
|
- name: repo-url
|
||||||
type: string
|
type: string
|
||||||
description: The git repo URL to clone from.
|
description: The git repo URL to clone from.
|
||||||
|
- name: revision
|
||||||
|
type: string
|
||||||
|
description: The git repo branch to checkout.
|
||||||
- name: image
|
- name: image
|
||||||
type: string
|
type: string
|
||||||
description: Full name of image repo.
|
description: Full name of image repo.
|
||||||
@ -33,6 +36,10 @@ spec:
|
|||||||
params:
|
params:
|
||||||
- name: url
|
- name: url
|
||||||
value: $(params.repo-url)
|
value: $(params.repo-url)
|
||||||
|
- name: revision
|
||||||
|
value: $(params.revision)
|
||||||
|
- name: submodules
|
||||||
|
value: 'false'
|
||||||
# Lecture du readme du projet
|
# Lecture du readme du projet
|
||||||
- name: show-readme
|
- name: show-readme
|
||||||
runAfter: ["fetch-source"]
|
runAfter: ["fetch-source"]
|
||||||
@ -68,30 +75,45 @@ spec:
|
|||||||
- name: config
|
- name: config
|
||||||
workspace: config
|
workspace: config
|
||||||
|
|
||||||
- name: kaniko-build
|
# Execution des tests unitaires avec une BDD en sidecar
|
||||||
taskRef:
|
- name: php-unit-test
|
||||||
name: kaniko
|
|
||||||
params:
|
|
||||||
- name: IMAGE
|
|
||||||
value: $(params.image)
|
|
||||||
- name: DOCKERFILE
|
|
||||||
value: $(params.dockerfile)
|
|
||||||
- name: EXTRA_ARGS
|
|
||||||
value:
|
|
||||||
- --skip-tls-verify
|
|
||||||
- --insecure
|
|
||||||
workspaces:
|
|
||||||
- name: source
|
|
||||||
workspace: shared-data
|
|
||||||
- name: dockerconfig
|
|
||||||
workspace: docker-credentials
|
|
||||||
runAfter:
|
runAfter:
|
||||||
- fetch-source
|
- fetch-source
|
||||||
# - php-cs-fixer
|
# - php-cs-fixer
|
||||||
# - phpstan
|
# - phpstan
|
||||||
# - php-security-check
|
# - php-security-check
|
||||||
retries: 3
|
taskRef:
|
||||||
|
name: php-unit-test
|
||||||
|
workspaces:
|
||||||
|
- name: source
|
||||||
|
workspace: shared-data
|
||||||
|
|
||||||
|
# - name: kaniko-build
|
||||||
|
# taskRef:
|
||||||
|
# name: kaniko
|
||||||
|
# params:
|
||||||
|
# - name: IMAGE
|
||||||
|
# value: $(params.image)
|
||||||
|
# - name: DOCKERFILE
|
||||||
|
# value: $(params.dockerfile)
|
||||||
|
# - name: BUILDER_IMAGE
|
||||||
|
# value: gcr.io/kaniko-project/executor:v1.20.0
|
||||||
|
# - name: EXTRA_ARGS
|
||||||
|
# value:
|
||||||
|
# - --skip-tls-verify
|
||||||
|
# - --insecure
|
||||||
|
# - --ignore-path=/product_uuid
|
||||||
|
# workspaces:
|
||||||
|
# - name: source
|
||||||
|
# workspace: shared-data
|
||||||
|
# - name: dockerconfig
|
||||||
|
# workspace: docker-credentials
|
||||||
|
# runAfter:
|
||||||
|
# - fetch-source
|
||||||
|
# # - php-cs-fixer
|
||||||
|
# # - phpstan
|
||||||
|
# # - php-security-check
|
||||||
|
# retries: 3
|
||||||
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ apiVersion: tekton.dev/v1beta1
|
|||||||
kind: PipelineRun
|
kind: PipelineRun
|
||||||
metadata:
|
metadata:
|
||||||
generateName: symfonyapp-run-
|
generateName: symfonyapp-run-
|
||||||
|
namespace: tekton
|
||||||
spec:
|
spec:
|
||||||
serviceAccountName: build-bot
|
serviceAccountName: build-bot
|
||||||
pipelineRef:
|
pipelineRef:
|
||||||
@ -26,7 +27,9 @@ spec:
|
|||||||
secretName: regcred
|
secretName: regcred
|
||||||
params:
|
params:
|
||||||
- name: repo-url
|
- name: repo-url
|
||||||
value: https://forge.cadoles.com/Cadoles/hydra-dispatcher.git
|
value: https://forge.cadoles.com/CNOUS/mse.git
|
||||||
|
- name: revision
|
||||||
|
value: k8s
|
||||||
- name: image
|
- name: image
|
||||||
value: reg.cadoles.com/mlamalle/testtekton
|
value: reg.cadoles.com/mlamalle/testtekton
|
||||||
- name: dockerfile
|
- name: dockerfile
|
||||||
|
@ -7,3 +7,4 @@ resources:
|
|||||||
- task/php-cs-fixer.yaml
|
- task/php-cs-fixer.yaml
|
||||||
- task/php-security-check.yaml
|
- task/php-security-check.yaml
|
||||||
- task/phpstan.yaml
|
- task/phpstan.yaml
|
||||||
|
- task/php-unit-test.yaml
|
||||||
|
@ -0,0 +1,68 @@
|
|||||||
|
apiVersion: tekton.dev/v1beta1
|
||||||
|
kind: Task
|
||||||
|
metadata:
|
||||||
|
name: php-unit-test
|
||||||
|
spec:
|
||||||
|
description: PHP unit 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'
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
args:
|
||||||
|
- '-c'
|
||||||
|
- |
|
||||||
|
set -ex
|
||||||
|
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 unit --stderr --testdox -d memory_limit=512M
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user