ci: deployment rules
This commit is contained in:
parent
26c40afb2f
commit
f8425e7d54
24
.gitea/workflows/deploy.yml
Normal file
24
.gitea/workflows/deploy.yml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
name: Deploy
|
||||||
|
run-name: ${{ gitea.actor }} build image and push to container registry
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'main'
|
||||||
|
- 'staging'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
CreateImage:
|
||||||
|
runs-on: [hubstaging]
|
||||||
|
uses: http://gitea.pena/PenaDevops/actions.git/.gitea/workflows/build-image.yml@v1.1.6-p
|
||||||
|
with:
|
||||||
|
runner: hubstaging
|
||||||
|
secrets:
|
||||||
|
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
|
||||||
|
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
|
DeployService:
|
||||||
|
runs-on: [hubstaging]
|
||||||
|
needs: CreateImage
|
||||||
|
uses: http://gitea.pena/PenaDevops/actions.git/.gitea/workflows/deploy.yml@v1.1.4-p7
|
||||||
|
with:
|
||||||
|
runner: hubstaging
|
14
.gitea/workflows/lint.yml
Normal file
14
.gitea/workflows/lint.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
name: Lint
|
||||||
|
run-name: ${{ gitea.actor }} produce linting
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'dev'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Lint:
|
||||||
|
runs-on: [hubstaging]
|
||||||
|
uses: http://gitea.pena/PenaDevops/actions.git/.gitea/workflows/lint.yml@v1.1.2
|
||||||
|
with:
|
||||||
|
runner: hubstaging
|
@ -1,31 +0,0 @@
|
|||||||
include:
|
|
||||||
- project: "devops/pena-continuous-integration"
|
|
||||||
file: "/templates/docker/build-template.gitlab-ci.yml"
|
|
||||||
- project: "devops/pena-continuous-integration"
|
|
||||||
file: "/templates/docker/deploy-template.gitlab-ci.yml"
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- build
|
|
||||||
- deploy
|
|
||||||
|
|
||||||
build-app:
|
|
||||||
stage: build
|
|
||||||
extends: .build_template
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_BRANCH == $PRODUCTION_BRANCH || $CI_COMMIT_BRANCH == $STAGING_BRANCH
|
|
||||||
|
|
||||||
deploy-to-staging:
|
|
||||||
stage: deploy
|
|
||||||
tags:
|
|
||||||
- staging
|
|
||||||
extends: .deploy_template
|
|
||||||
rules:
|
|
||||||
- if: "$CI_COMMIT_BRANCH == $STAGING_BRANCH"
|
|
||||||
|
|
||||||
deploy-to-prod:
|
|
||||||
stage: deploy
|
|
||||||
tags:
|
|
||||||
- prod
|
|
||||||
extends: .deploy_template
|
|
||||||
rules:
|
|
||||||
- if: "$CI_COMMIT_BRANCH == $PRODUCTION_BRANCH"
|
|
@ -1,5 +1,5 @@
|
|||||||
# BUILD
|
# BUILD
|
||||||
FROM golang:1.20.3-alpine AS build
|
FROM gitea.pena/penadevops/container-images/golang:main as build
|
||||||
|
|
||||||
# Update depences
|
# Update depences
|
||||||
RUN apk update && apk add --no-cache curl
|
RUN apk update && apk add --no-cache curl
|
||||||
@ -17,7 +17,7 @@ ADD . /app
|
|||||||
RUN GOOS=linux go build -o bin ./...
|
RUN GOOS=linux go build -o bin ./...
|
||||||
|
|
||||||
# PRODUCTION
|
# PRODUCTION
|
||||||
FROM alpine:latest AS production
|
FROM gitea.pena/penadevops/container-images/alpine:main
|
||||||
|
|
||||||
# Install packages
|
# Install packages
|
||||||
RUN apk --no-cache add ca-certificates
|
RUN apk --no-cache add ca-certificates
|
||||||
|
@ -2,9 +2,7 @@ version: "3.3"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
treasurer-app-staging:
|
treasurer-app-staging:
|
||||||
hostname: treasurer-service-staging
|
image: gitea.pena:3000/penaside/treasurer/staging:$GITHUB_RUN_NUMBER
|
||||||
container_name: treasurer-service-staging
|
|
||||||
image: $CI_REGISTRY_IMAGE/staging:$CI_COMMIT_REF_SLUG.$CI_PIPELINE_ID
|
|
||||||
tty: true
|
tty: true
|
||||||
environment:
|
environment:
|
||||||
- HTTP_HOST=0.0.0.0
|
- HTTP_HOST=0.0.0.0
|
||||||
@ -22,21 +20,13 @@ services:
|
|||||||
- YOOMONEY_WEBHOOKS_URL=http://treasurer-mock-staging:8080/webhooks
|
- YOOMONEY_WEBHOOKS_URL=http://treasurer-mock-staging:8080/webhooks
|
||||||
- YOOMONEY_PAYMENTS_URL=https://api.yookassa.ru/v3/payments
|
- YOOMONEY_PAYMENTS_URL=https://api.yookassa.ru/v3/payments
|
||||||
|
|
||||||
- MONGO_HOST=10.8.0.6
|
- MONGO_HOST=10.7.0.6
|
||||||
- MONGO_PORT=27017
|
- MONGO_PORT=27017
|
||||||
- MONGO_USER=$MONGO_USER
|
- MONGO_USER=treasurer
|
||||||
- MONGO_PASSWORD=$MONGO_PASSWORD
|
- MONGO_PASSWORD=Wr5uCLwIu7CEeWT3
|
||||||
- MONGO_DB_NAME=treasurer
|
- MONGO_DB_NAME=treasurer
|
||||||
- MONGO_AUTH=treasurer
|
- MONGO_AUTH=treasurer
|
||||||
ports:
|
ports:
|
||||||
- 10.8.0.6:8085:8085
|
- 10.7.0.6:8085:8085
|
||||||
- 10.8.0.6:9085:9085
|
- 10.7.0.6:9085:9085
|
||||||
networks:
|
|
||||||
- backend_external
|
|
||||||
- default
|
|
||||||
networks:
|
|
||||||
backend_external:
|
|
||||||
driver: bridge
|
|
||||||
attachable: true
|
|
||||||
internal: true
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user