Commit 6df6ac9f authored by nguyenvu's avatar nguyenvu

Update project

parent 5f900c13
Pipeline #6754 canceled with stages
...@@ -19,6 +19,7 @@ build: ...@@ -19,6 +19,7 @@ build:
before_script: before_script:
- echo "Please remember that for dev environment, we use the tag 'dev' only !!!" - echo "Please remember that for dev environment, we use the tag 'dev' only !!!"
- tag=dev - tag=dev
- cicd_path=$(grep "path" .gitmodules | cut -d "=" -f2 | cut -d " " -f2)
- current_file_path=$(pwd)/MEU.API/Resources/ReleaseNotes/releasenotes.txt - current_file_path=$(pwd)/MEU.API/Resources/ReleaseNotes/releasenotes.txt
- release_note_folder=/var/www/release_note - release_note_folder=/var/www/release_note
- | - |
...@@ -49,11 +50,12 @@ build: ...@@ -49,11 +50,12 @@ build:
sudo bash -c "echo $value_base64 > $current_file_path" sudo bash -c "echo $value_base64 > $current_file_path"
sudo bash -c "cat $current_file_path > $release_note_folder/$project_name/releasenotes.txt" sudo bash -c "cat $current_file_path > $release_note_folder/$project_name/releasenotes.txt"
- sudo docker build -t $image_name:$tag -f Dockerfile . - sudo bash $cicd_path/build.sh
- sudo docker logout registry.gitlab.com #- sudo docker build -t $image_name:$tag -f Dockerfile .
- echo "$CI_REGISTRY_PW" | sudo docker login registry.gitlab.com -u "$CI_REGISTRY_USER" --password-stdin #- sudo docker logout registry.gitlab.com
- sudo docker push $image_name:$tag #- echo "$CI_REGISTRY_PW" | sudo docker login registry.gitlab.com -u "$CI_REGISTRY_USER" --password-stdin
- sudo docker rmi $image_name:$tag #- sudo docker push $image_name:$tag
#- sudo docker rmi $image_name:$tag
only: only:
- develop - develop
tags: tags:
...@@ -62,6 +64,7 @@ build: ...@@ -62,6 +64,7 @@ build:
deploy: deploy:
stage: deploy stage: deploy
before_script: before_script:
- cicd_path=$(grep "path" .gitmodules | cut -d "=" -f2 | cut -d " " -f2)
- whoami - whoami
- ifconfig - ifconfig
- sudo apt-get install jq -y - sudo apt-get install jq -y
...@@ -87,18 +90,19 @@ deploy: ...@@ -87,18 +90,19 @@ deploy:
sudo chown -R gitlab-runner.gitlab-runner $mount_data_folder/$project_name sudo chown -R gitlab-runner.gitlab-runner $mount_data_folder/$project_name
fi fi
script: script:
- tag=dev - sudo bash deploy.sh
- jq -r 'keys[] as $k | "\($k)=\(.[$k])"' $environment_json_path > .env #- tag=dev
- sed -i 's|PROJECT-NAME|'$project_name'|' docker-compose.yaml #- jq -r 'keys[] as $k | "\($k)=\(.[$k])"' $environment_json_path > .env
- sed -i 's|ENVIRONMENT-NAME|'$environment_name'|' docker-compose.yaml #- sed -i 's|PROJECT-NAME|'$project_name'|' docker-compose.yaml
- sed -i 's|IMAGE-NAME|'$image_name'|' docker-compose.yaml #- sed -i 's|ENVIRONMENT-NAME|'$environment_name'|' docker-compose.yaml
- sed -i 's|IMAGE-TAG|'$tag'|' docker-compose.yaml #- sed -i 's|IMAGE-NAME|'$image_name'|' docker-compose.yaml
- sed -i 's|P-MAPPING|'$port_mapping'|' docker-compose.yaml #- sed -i 's|IMAGE-TAG|'$tag'|' docker-compose.yaml
- sed -i 's|MOUNT-DATA-FOLDER|'$mount_data_folder'|' docker-compose.yaml #- sed -i 's|P-MAPPING|'$port_mapping'|' docker-compose.yaml
- echo "$CI_REGISTRY_PW" | sudo docker login registry.gitlab.com -u "$CI_REGISTRY_USER" --password-stdin #- sed -i 's|MOUNT-DATA-FOLDER|'$mount_data_folder'|' docker-compose.yaml
- sudo docker-compose down #- echo "$CI_REGISTRY_PW" | sudo docker login registry.gitlab.com -u "$CI_REGISTRY_USER" --password-stdin
- sudo docker-compose pull #- sudo docker-compose down
- sudo docker-compose --env-file .env up -d #- sudo docker-compose pull
#- sudo docker-compose --env-file .env up -d
only: only:
- develop - develop
tags: tags:
......
[submodule "cicd"]
path = cicd
url = http://27.74.255.96:8088/trainguyen/cicd.git
branch = feature-cicd
cicd @ 926a6d6d
Subproject commit 926a6d6d4e33e266700e8c532fc16f160c8583e2
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment