Git server side hook trial

Source: Internet
Author: User
Tags git hooks

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
    • Docker-compose
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
    • Configure Gogs
http://localhost:10080  按照提示即可
Configure Git server side hooks

Server side hook in custom_hooks directory

    • Create a project

    • Configuring hooks

    • Server-Side effects

Test
    • Clone code
git clone http://localhost:10080/dalong/demo.git
    • Modify a Submission
修改index.html 即可
    • Effect


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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.