Commit 7568502f authored by Bùi Bá Trường's avatar Bùi Bá Trường

truongbb - test email

parent 7c24f1f1
Pipeline #495 failed with stages
in 11 seconds
image: node:latest image: node:latest
before_script: before_script:
# Setup SSH deploy keys
- 'which ssh-agent || ( yum install -qq openssh-client )' - 'which ssh-agent || ( yum install -qq openssh-client )'
- eval $(ssh-agent -s) - eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
...@@ -11,30 +10,14 @@ before_script: ...@@ -11,30 +10,14 @@ before_script:
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- whoami - whoami
- unset SSH_ASKPASS - unset SSH_ASKPASS
# Cache node modules - speeds up future builds
# cache:
# paths:
# - node_modules
# variables:
# PUBLIC_URL: /reactjs-ci
stages: stages:
# - test - checkout
- build - build
- send_email # - send_email
# test:
# stage: test
# script:
# - npm install
# - npm test
# artifacts:
# paths:
# - dist/
build: checkout:
stage: build stage: checkout
only: only:
- master - master
# - merge_requests # - merge_requests
...@@ -46,29 +29,32 @@ build: ...@@ -46,29 +29,32 @@ build:
- git config --global user.name 'truongbb96' - git config --global user.name 'truongbb96'
- git config --global user.email 'truongbb@itsol.vn' - git config --global user.email 'truongbb@itsol.vn'
- git clone https://truongbb96:hoanghuynh0801@git.myitsol.com/truongbb96/reactjs-ci.git - git clone https://truongbb96:hoanghuynh0801@git.myitsol.com/truongbb96/reactjs-ci.git
- cd ./reactjs-ci
- sh ./build.sh
- ls
build:
stage: build
only:
- master
# - merge_requests
script:
- cd /root/GitlabRunner/repo/reactjs-ci
- sh ./build.sh
# - ssh -o StrictHostKeyChecking=no root@192.168.1.201 "cd /root/GitlabRunner/repo/ && ls && rm -rf ./ci" # - ssh -o StrictHostKeyChecking=no root@192.168.1.201 "cd /root/GitlabRunner/repo/ && ls && rm -rf ./ci"
# - ssh -o StrictHostKeyChecking=no root@192.168.1.201 "cd /root/GitlabRunner/repo && unset SSH_ASKPASS && git config --global user.name 'truongbb96' && git config --global user.email 'truongbb@itsol.vn' && git clone https://truongbb96:hoanghuynh0801@git.myitsol.com/truongbb96/ci.git" # - ssh -o StrictHostKeyChecking=no root@192.168.1.201 "cd /root/GitlabRunner/repo && unset SSH_ASKPASS && git config --global user.name 'truongbb96' && git config --global user.email 'truongbb@itsol.vn' && git clone https://truongbb96:hoanghuynh0801@git.myitsol.com/truongbb96/ci.git"
# - ssh -o StrictHostKeyChecking=no root@192.168.1.201 "cd /root/GitlabRunner/repo/ci && npm install && npm start" # - ssh -o StrictHostKeyChecking=no root@192.168.1.201 "cd /root/GitlabRunner/repo/ci && npm install && npm start"
# - ssh -o StrictHostKeyChecking=no root@192.168.1.201 "cd /root/GitlabRunner/repo/ci && docker-compose -p app -f docker-compose.yml down && echo '-------------' && docker-compose -p app -f docker-compose.yml build && echo '-------------' && docker-compose -p app -f docker-compose.yml up" # - ssh -o StrictHostKeyChecking=no root@192.168.1.201 "cd /root/GitlabRunner/repo/ci && docker-compose -p app -f docker-compose.yml down && echo '-------------' && docker-compose -p app -f docker-compose.yml build && echo '-------------' && docker-compose -p app -f docker-compose.yml up"
# - ssh -o StrictHostKeyChecking=no root@192.168.1.201 "cd /root/GitlabRunner/repo/ci && sh ./build.sh" # - ssh -o StrictHostKeyChecking=no root@192.168.1.201 "cd /root/GitlabRunner/repo/ci && sh ./build.sh"
# - ssh -o StrictHostKeyChecking=no root@192.168.1.201 "ls" # test command
artifacts: artifacts:
paths: paths:
- public # The built files for Gitlab Pages to serve - public
send_email: # send_email:
stage: send_email # stage: send_email
only: # only:
- master # - master
# - merge_requests # # - merge_requests
script: # script:
- curl --request POST # - curl --request POST
--url https://api.sendgrid.com/v3/mail/send # --url https://api.sendgrid.com/v3/mail/send
--header 'Authorization:Bearer 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' # --header 'Authorization:Bearer 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'
--header 'Content-Type:application/json' # --header 'Content-Type:application/json'
--data '{"personalizations":[{"to":[{"email":"truongbb96@gmail.com"}]}],"from":{"email":"truongbb@itsol.vn"},"subject":"CI pipeline result","content":[{"type":"text/plain","value":"CI pipeline done!"}]}' # --data '{"personalizations":[{"to":[{"email":"truongbb96@gmail.com"}]}],"from":{"email":"truongbb@itsol.vn"},"subject":"CI pipeline result","content":[{"type":"text/plain","value":"CI pipeline done!"}]}'
\ No newline at end of file \ No newline at end of file
image: node:latest
before_script:
# Setup SSH deploy keys
- 'which ssh-agent || ( yum install -qq openssh-client )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan -t rsa 192.168.1.201 >> ~/.ssh/known_hosts
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- whoami
- unset SSH_ASKPASS
stages:
- build
- send_email
build:
stage: build
only:
- master
# - merge_requests
script:
# - ssh -o StrictHostKeyChecking=no root#@192.168.1.201 "ls" # test command
- ls
- cd /root/GitlabRunner/repo/ && ls
- rm -rf ./ci
- git config --global user.name 'truongbb96'
- git config --global user.email 'truongbb@itsol.vn'
- git clone https://truongbb96:hoanghuynh0801@git.myitsol.com/truongbb96/reactjs-ci.git
- cd ./reactjs-ci
- sh ./build.sh
- ls
# - ssh -o StrictHostKeyChecking=no root@192.168.1.201 "cd /root/GitlabRunner/repo/ && ls && rm -rf ./ci"
# - ssh -o StrictHostKeyChecking=no root@192.168.1.201 "cd /root/GitlabRunner/repo && unset SSH_ASKPASS && git config --global user.name 'truongbb96' && git config --global user.email 'truongbb@itsol.vn' && git clone https://truongbb96:hoanghuynh0801@git.myitsol.com/truongbb96/ci.git"
# - ssh -o StrictHostKeyChecking=no root@192.168.1.201 "cd /root/GitlabRunner/repo/ci && npm install && npm start"
# - ssh -o StrictHostKeyChecking=no root@192.168.1.201 "cd /root/GitlabRunner/repo/ci && docker-compose -p app -f docker-compose.yml down && echo '-------------' && docker-compose -p app -f docker-compose.yml build && echo '-------------' && docker-compose -p app -f docker-compose.yml up"
# - ssh -o StrictHostKeyChecking=no root@192.168.1.201 "cd /root/GitlabRunner/repo/ci && sh ./build.sh"
# - ssh -o StrictHostKeyChecking=no root@192.168.1.201 "ls" # test command
artifacts:
paths:
- public
send_email:
stage: send_email
only:
- master
# - merge_requests
script:
- curl --request POST
--url https://api.sendgrid.com/v3/mail/send
--header 'Authorization:Bearer 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'
--header 'Content-Type:application/json'
--data '{"personalizations":[{"to":[{"email":"truongbb96@gmail.com"}]}],"from":{"email":"truongbb@itsol.vn"},"subject":"CI pipeline result","content":[{"type":"text/plain","value":"CI pipeline done!"}]}'
\ No newline at end of file
#!/bin/bash #!/bin/bash
# echo "Revert source code!"
# git checkout src
# git checkout public
# echo "Done!"
# echo "Pulling new source version!"
# git pull
# echo "Done!"
echo "-------------------------Shut down all!-------------------------" echo "-------------------------Shut down all!-------------------------"
docker-compose -p app -f docker-compose.yml down docker-compose -p app -f docker-compose.yml down
......
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