diff --git a/Jenkinsfile b/Jenkinsfile index d07b47809..e08c319ea 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -69,13 +69,13 @@ pipeline { } } } - /* stage('Backend') { + stage('Backend') { steps { nodejs('node-lts') { sh 'gulp backTestOnce --ci' } } - } */ + } } } stage('Build') { diff --git a/db/Dockerfile b/db/Dockerfile index 00d54993a..8980c34f4 100644 --- a/db/Dockerfile +++ b/db/Dockerfile @@ -14,20 +14,41 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* COPY docker/docker.cnf /etc/mysql/conf.d/ -COPY docker/docker-init.sh docker/docker-start.sh /usr/local/bin/ +COPY \ + docker/docker-init.sh \ + docker/docker-temp-start.sh \ + docker/docker-temp-stop.sh \ + docker/docker-dump.sh \ + docker/docker-start.sh \ + /usr/local/bin/ RUN mkdir /mysql-data \ && chown -R mysql:mysql /mysql-data -COPY dump /docker-boot/dump -COPY changes /docker-boot/changes -COPY import-changes.sh config.ini /docker-boot/ +WORKDIR /docker-boot -COPY docker/docker-boot.sh /docker-entrypoint-initdb.d/ +COPY \ + import-changes.sh \ + config.ini \ + dump/mysqlPlugins.sql \ + dump/structure.sql \ + dump/dumpedFixtures.sql \ + ./ +RUN gosu mysql docker-init.sh \ + && docker-dump.sh mysqlPlugins \ + && docker-dump.sh structure \ + && docker-dump.sh dumpedFixtures \ + && gosu mysql docker-temp-stop.sh +COPY changes ./changes +COPY dump/fixtures.sql ./ ARG STAMP=unknown -RUN gosu mysql docker-init.sh mysqld \ - && rm -rf /docker-entrypoint-initdb.d/* \ +RUN gosu mysql docker-temp-start.sh \ + && ./import-changes.sh \ + && docker-dump.sh fixtures \ + && gosu mysql docker-temp-stop.sh + +RUN echo "[INFO] -> Import finished" \ && rm -rf /docker-boot USER mysql @@ -35,5 +56,5 @@ ENTRYPOINT ["docker-start.sh"] CMD ["mysqld"] -HEALTHCHECK --interval=5s --timeout=10s --retries=200 \ - CMD mysqladmin ping -h 127.0.0.1 -u root || exit 1 +HEALTHCHECK --interval=2s --timeout=10s --retries=200 \ + CMD mysqladmin ping -h 127.0.0.1 -u root --password=root || exit 1 diff --git a/db/PASTE_COMMENT_REMINDER b/db/PASTE_COMMENT_REMINDER new file mode 100644 index 000000000..f4468157f --- /dev/null +++ b/db/PASTE_COMMENT_REMINDER @@ -0,0 +1,4 @@ +/** + * Hay una versión en salix que machacará toda esta función/procedimiento avisa + * a ___ de los cambios que quieres hacer. + */ \ No newline at end of file diff --git a/db/changes/10221-accountModule/00-user_getNameFromId.sql b/db/changes/10221-accountModule/00-user_getNameFromId.sql index ae9ae5941..fc3b721c5 100644 --- a/db/changes/10221-accountModule/00-user_getNameFromId.sql +++ b/db/changes/10221-accountModule/00-user_getNameFromId.sql @@ -13,8 +13,8 @@ BEGIN SELECT `name` INTO vName FROM user - WHERE id = vId; + WHERE id = vSelf; - RETURN vSelf; + RETURN vName; END$$ DELIMITER ; diff --git a/db/changes/PASTE_COMMENT_REMINDER b/db/changes/PASTE_COMMENT_REMINDER deleted file mode 100644 index 07b707920..000000000 --- a/db/changes/PASTE_COMMENT_REMINDER +++ /dev/null @@ -1,4 +0,0 @@ -/* -Hay una versión en salix que machacará toda esta función/procedimiento -avisa a ___ de los cambios que quieres hacer -*/ \ No newline at end of file diff --git a/db/docker.js b/db/docker.js index 0cb912be6..ff330f824 100644 --- a/db/docker.js +++ b/db/docker.js @@ -53,7 +53,7 @@ module.exports = class Docker { this.dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort']; } - await this.waitForHealthy(); + await this.wait(); } catch (err) { if (this.isRandom) await this.rm(); @@ -147,7 +147,7 @@ module.exports = class Docker { let state; try { - let result = await this.execP(`docker container inspect -f "{{json .State}}" ${this.id}`); + let result = await this.execP(`docker inspect -f "{{json .State}}" ${this.id}`); state = JSON.parse(result.stdout); } catch (err) { return reject(new Error(err.message)); diff --git a/db/docker/docker-boot.sh b/db/docker/docker-boot.sh deleted file mode 100755 index 5e8ad4c6c..000000000 --- a/db/docker/docker-boot.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -cd /docker-boot -export MYSQL_PWD=root - -mysql_import() { - FILE=$1 - echo "[INFO] -> Importing $FILE" - mysql -u root --default-character-set=utf8 --comments -f < "$FILE" -} - -mysql_import dump/structure.sql -mysql_import dump/mysqlPlugins.sql -mysql_import dump/dumpedFixtures.sql -./import-changes.sh -mysql_import dump/fixtures.sql - -echo "[INFO] -> Import finished" diff --git a/db/docker/docker-dump.sh b/db/docker/docker-dump.sh new file mode 100755 index 000000000..0d7a379a7 --- /dev/null +++ b/db/docker/docker-dump.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +export MYSQL_PWD=root +FILE="/docker-boot/$1.sql" +echo "[INFO] -> Importing $FILE" +mysql -u root --default-character-set=utf8 --comments -f < "$FILE" diff --git a/db/docker/docker-init.sh b/db/docker/docker-init.sh index f2c9d58d7..ccd14283e 100755 --- a/db/docker/docker-init.sh +++ b/db/docker/docker-init.sh @@ -1,16 +1,14 @@ #!/bin/bash . /usr/local/bin/docker-entrypoint.sh +CMD=mysqld -mysql_check_config "$@" -docker_setup_env "$@" +mysql_check_config "$CMD" +docker_setup_env "$CMD" docker_create_db_directories docker_verify_minimum_env -docker_init_database_dir "$@" -docker_temp_server_start "$@" +docker_init_database_dir "$CMD" +docker_temp_server_start "$CMD" docker_setup_db - docker_process_init_files /docker-entrypoint-initdb.d/* - -docker_temp_server_stop diff --git a/db/docker/docker-temp-start.sh b/db/docker/docker-temp-start.sh new file mode 100755 index 000000000..fc067102f --- /dev/null +++ b/db/docker/docker-temp-start.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +. /usr/local/bin/docker-entrypoint.sh +CMD=mysqld + +docker_setup_env "$CMD" +docker_temp_server_start "$CMD" diff --git a/db/docker/docker-temp-stop.sh b/db/docker/docker-temp-stop.sh new file mode 100755 index 000000000..df66959df --- /dev/null +++ b/db/docker/docker-temp-stop.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +. /usr/local/bin/docker-entrypoint.sh +CMD=mysqld + +docker_setup_env "$CMD" +docker_temp_server_stop