From 9d8949130ff44bd2a78ddaa3184599aa4c3369c1 Mon Sep 17 00:00:00 2001 From: Bossanyi Tibor Date: Tue, 12 May 2020 21:29:05 +0200 Subject: [PATCH 1/3] deploy stage files --- .gitlab-ci.yml | 13 +++++++------ ci-cd/.ssh/.scp | 1 + ci-cd/deploy.sh | 1 + 3 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 ci-cd/.ssh/.scp create mode 100644 ci-cd/deploy.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 824288f..3282e07 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,7 @@ stages: - build - prepare - test -# - deploy + - deploy variables: # Configure mysql environment variables (https://hub.docker.com/_/mysql/) @@ -43,7 +43,7 @@ connect: script: - apt-get update && apt-get --assume-yes install mysql-client - mysql --user=root --password="$MYSQL_ROOT_PASSWORD" --host=mysql -e "use $MYSQL_DATABASE; show tables;" - - mysql --user=root --password="$MYSQL_ROOT_PASSWORD" --host=mysql -e "use $MYSQL_DATABASE; DROP table customer; DROP table exercises; DROP table exercise_types; DROP table exercise_ages;" + - mysql --user=root --password="$MYSQL_ROOT_PASSWORD" --host=mysql -e "use $MYSQL_DATABASE; DROP table customer; DROP table exercises; DROP table exercise_type; DROP table exercise_ages;" - mysql --user=root --password="$MYSQL_ROOT_PASSWORD" --host=mysql < "data/db/install.sql" #first time test: @@ -53,10 +53,11 @@ test: - export spring_profiles_active=test - ./gradlew check -#deploy: -# stage: deploy -# script: -# - ./deploy +deploy: + stage: deploy + script: + - apt-get update && apt-get --assume-yes install sshpass + - ci-cd/deploy.sh after_script: - echo "End CI" diff --git a/ci-cd/.ssh/.scp b/ci-cd/.ssh/.scp new file mode 100644 index 0000000..7f7f899 --- /dev/null +++ b/ci-cd/.ssh/.scp @@ -0,0 +1 @@ +tbi6012AndiBossanyi \ No newline at end of file diff --git a/ci-cd/deploy.sh b/ci-cd/deploy.sh new file mode 100644 index 0000000..8ccdbe5 --- /dev/null +++ b/ci-cd/deploy.sh @@ -0,0 +1 @@ +sshpass -f /ci-cd/.ssh/.scp scp build/libs/aitrainer_server-0.0.2.jar bosi@andio.shop:/home/bosi/deploy/aitrainer_server.jar \ No newline at end of file From fa0cf72f501d557f93fd40ce47f48ae611394177 Mon Sep 17 00:00:00 2001 From: Bossanyi Tibor Date: Tue, 12 May 2020 21:32:42 +0200 Subject: [PATCH 2/3] deploy stage files --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3282e07..f621509 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -43,7 +43,7 @@ connect: script: - apt-get update && apt-get --assume-yes install mysql-client - mysql --user=root --password="$MYSQL_ROOT_PASSWORD" --host=mysql -e "use $MYSQL_DATABASE; show tables;" - - mysql --user=root --password="$MYSQL_ROOT_PASSWORD" --host=mysql -e "use $MYSQL_DATABASE; DROP table customer; DROP table exercises; DROP table exercise_type; DROP table exercise_ages;" + - mysql --user=root --password="$MYSQL_ROOT_PASSWORD" --host=mysql -e "use $MYSQL_DATABASE; DROP table if exists customer; DROP table if exists exercises; DROP table if exists exercise_type; DROP table if exists exercise_ages;" - mysql --user=root --password="$MYSQL_ROOT_PASSWORD" --host=mysql < "data/db/install.sql" #first time test: From 408d034babfdf2bce3c06999e0d3133e9ab29cce Mon Sep 17 00:00:00 2001 From: Bossanyi Tibor Date: Tue, 12 May 2020 21:39:57 +0200 Subject: [PATCH 3/3] deploy ci fix --- .gitlab-ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f621509..fe5341d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,4 @@ -services: - - mysql:latest + stages: - build @@ -55,9 +54,12 @@ test: deploy: stage: deploy + image: mysql:latest script: - apt-get update && apt-get --assume-yes install sshpass - ci-cd/deploy.sh + only: + - master after_script: - echo "End CI"