feat: refs #6695 jenkins run e2e
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2024-10-04 12:08:47 +02:00
parent 81cbeff449
commit da61df0a2a
7 changed files with 69 additions and 51 deletions

22
Jenkinsfile vendored
View File

@ -92,12 +92,22 @@ pipeline {
IMAGE = "$REGISTRY/salix-back" IMAGE = "$REGISTRY/salix-back"
} }
steps { steps {
sh 'docker pull $IMAGE:dev' // // sh 'docker pull $IMAGE:dev'
sh 'docker ps -a' // sh 'git clone https://gitea.verdnatura.es/verdnatura/salix.git'
sh 'docker network create salix_default' // // sh 'docker ps -a'
sh 'docker-compose -f docker-compose.yml build db' // sh 'docker network create salix_default'
sh 'docker-compose -f docker-compose.yml up db' // sh 'docker-compose -f docker-compose.yml build db'
sh 'docker run --name back $IMAGE:dev' // sh 'docker-compose -f docker-compose.yml up db'
// sh 'docker run --name back $IMAGE:dev'
sh 'git clone --branch dev https://gitea.verdnatura.es/verdnatura/salix.git'
sh 'cd front'
// sh '# export VERSION=e2e-try'
sh 'docker buildx build -f salix/back/Dockerfile -t back ./salix'
sh 'docker-compose -f docker-compose.e2e.yml up db'
sh 'docker run --net=host -v ./test/cypress/storage:/salix/storage -d back'
sh 'docker-compose -f docker-compose.e2e.yml -d up front'
sh 'docker-compose -f docker-compose.e2e.yml up e2e --build'
} }
post { post {
always { always {

View File

@ -2,14 +2,14 @@ const { defineConfig } = require('cypress');
module.exports = defineConfig({ module.exports = defineConfig({
e2e: { e2e: {
baseUrl: 'http://front:9000/', baseUrl: 'http://localhost:9000/',
experimentalStudio: true, experimentalStudio: true,
fixturesFolder: 'test/cypress/fixtures', fixturesFolder: 'test/cypress/fixtures',
screenshotsFolder: 'test/cypress/screenshots', screenshotsFolder: 'test/cypress/screenshots',
supportFile: 'test/cypress/support/index.js', supportFile: 'test/cypress/support/index.js',
videosFolder: 'test/cypress/videos', videosFolder: 'test/cypress/videos',
video: false, video: false,
specPattern: 'test/cypress/integration/**/*.spec.js', specPattern: 'test/cypress/integration/claim/*.spec.js',
experimentalRunAllSpecs: true, experimentalRunAllSpecs: true,
component: { component: {
componentFolder: 'src', componentFolder: 'src',

12
dind.sh Normal file
View File

@ -0,0 +1,12 @@
docker stop dind-container || true && docker rm dind-container || true
docker run --privileged -d \
-p 2376:2376 \
-e DOCKER_TLS_CERTDIR="" \
--name dind-container \
-v /home/alexm/Projects/salix-front:/front \
docker:dind \
dockerd -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock
docker exec -it dind-container sh

View File

@ -6,33 +6,37 @@ services:
dockerfile: ./Dockerfile.e2e dockerfile: ./Dockerfile.e2e
ports: ports:
- 9000:9000 - 9000:9000
back: network_mode: host
image: registry.verdnatura.es/salix-back:${VERSION:?}
build:
context: .
dockerfile: back/Dockerfile
depends_on:
- db
ports:
- 3000:3000
- 5000:5000
volumes:
- ./test/cypress/storage:/salix/storage
db: db:
image: db image: db
command: npx myt run -t --ci -n salix-front_default command: npx myt run -t -d
build: build:
context: . context: .
dockerfile: test/cypress/db/Dockerfile dockerfile: test/cypress/db/Dockerfile
target: db target: db
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
network_mode: host
e2e: e2e:
image: registry.verdnatura.es/salix-frontend:${VERSION:?} image: registry.verdnatura.es/salix-frontend:${VERSION:?}
command: npx cypress run command: npx cypress run
build: build:
context: . context: .
dockerfile: ./Dockerfile.e2e dockerfile: ./Dockerfile.e2e
network_mode: host
# back:
# image: back
# build:
# context: ./salix
# dockerfile: salix/back/Dockerfile
# # depends_on:
# # - db
# ports:
# - 3000:3000
# - 5000:5000
# volumes:
# - ./test/cypress/storage:/salix/storage
# e2e-2: # e2e-2:
# image: registry.verdnatura.es/salix-frontend:${VERSION:?} # image: registry.verdnatura.es/salix-frontend:${VERSION:?}
# command: npx cypress run --config-file test/cypress/configs/cypress.config.2.js # command: npx cypress run --config-file test/cypress/configs/cypress.config.2.js

11
e2e.sh Normal file
View File

@ -0,0 +1,11 @@
git clone --branch dev https://gitea.verdnatura.es/verdnatura/salix.git
cd front
# export VERSION=e2e-try
docker buildx build -f salix/back/Dockerfile -t back ./salix
docker-compose -f docker-compose.e2e.yml up db
docker run --net=host -v ./test/cypress/storage:/salix/storage -d back
docker-compose -f docker-compose.e2e.yml -d up front
docker-compose -f docker-compose.e2e.yml up e2e --build

View File

@ -1,37 +1,18 @@
FROM registry.verdnatura.es/salix-back:e2e-try AS back FROM node:lts-bookworm
FROM docker:dind AS base ENV SHELL bash
ENV PNPM_HOME="/pnpm"
ENV TZ Europe/Madrid ENV PATH="$PNPM_HOME:$PATH"
ARG DEBIAN_FRONTEND=noninteractive RUN npm install -g pnpm@8.15.1
RUN pnpm setup
RUN apk update \ RUN apt install libkrb5-dev libssl-dev
&& apk add --update nodejs npm python3 \
krb5-dev libressl-dev
RUN apk update \
&& apk add --virtual build-dependencies \
build-base gcc wget git
RUN npm i -g pnpm RUN npm i -g pnpm
WORKDIR /salix WORKDIR /salix
# COPY --from=back /.git /test/cypress/.git COPY salix/db db
# COPY --from=back myt.config.yml /test/cypress COPY salix/myt.config.yml .
# COPY db db COPY salix/.git .git
# COPY node_modules node_modules
# COPY .git .git
# COPY myt.config.yml .
COPY --from=back salix/db db
COPY --from=back salix/myt.config.yml .
COPY --from=back salix/.git .git
COPY node_modules node_modules COPY node_modules node_modules
# RUN pnpm i @verdnatura/myt USAR NODE_MODULES HASTA QUE ESTE LA RAMA DE MYT FUSIONADA (MIENTRAS INSTALAR EN LILIUM, MYT Y MODIFICAR EL CODIGO DE myt-run.js) # RUN pnpm i @verdnatura/myt USAR NODE_MODULES HASTA QUE ESTE LA RAMA DE MYT FUSIONADA (MIENTRAS INSTALAR EN LILIUM, MYT Y MODIFICAR EL CODIGO DE myt-run.js)
FROM base AS db
WORKDIR /salix

View File

@ -83,7 +83,7 @@ Cypress.Commands.add('getValue', (selector) => {
Cypress.Commands.add('selectOption', (selector, option) => { Cypress.Commands.add('selectOption', (selector, option) => {
cy.waitForElement(selector); cy.waitForElement(selector);
cy.get(selector).find('.q-select__dropdown-icon').click(); cy.get(selector).find('.q-select__dropdown-icon').click();
cy.get('.q-menu .q-item').contains(option).click(); cy.get('.q-menu .q-item').contains(option).should('be.visible').click();
}); });
Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => { Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => {