Git hooks are a handy feature and we can use hooks to do multiple processing, such as client side hooks
Submit format check, server side for CI/CD processing
Test using Docker-compose to run Git server using Gogs
Environment preparation
version: ‘3‘services: gogs: image: gogs/gogs ports: - "10022:22" - "10080:3000" volumes: - ./data/gogs:/data depends_on: - mysql mysql: image: mysql:5.7.16 volumes: - ./gogs/mysql:/var/lib/mysql ports: - 3308:3306 command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci environment: MYSQL_ROOT_PASSWORD: dalongrong MYSQL_DATABASE: gogs MYSQL_USER: gogs MYSQL_PASSWORD: dalongrong TZ: Asia/Shanghai
http://localhost:10080 按照提示即可
Configure Git server side hooks
Server side hook in custom_hooks directory
Test
git clone http://localhost:10080/dalong/demo.git
修改index.html 即可
Heroku application deployment in a similar way
Description
Heroku should deploy the model also using a similar approach, when we commit, trigger the build of the app (Nodejs npm install container build, App launch ... )
At the same time we use hooks to do a lot more flexible CI/CD development
Resources
Https://github.com/gogs/gogs
Https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks#Server-Side-Hooks
Https://devcenter.heroku.com/articles/getting-started-with-nodejs#deploy-the-app
Git server side hook trial