+36
-48
@@ -1,89 +1,77 @@
|
|||||||
################################################################################
|
|
||||||
# my118/5
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: (dev) build form and push to artifactory
|
name: build-and-push
|
||||||
|
|
||||||
clone:
|
clone:
|
||||||
depth: 1
|
depth: 1
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build golang app admin and user
|
- name: build golang app
|
||||||
image: docker-mirror.ravanertebat.ir/hub/golang:1.24
|
image: golang:1.24
|
||||||
environment:
|
environment:
|
||||||
GOOS: linux
|
GOOS: linux
|
||||||
GOARCH: amd64
|
GOARCH: amd64
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
GOPROXY: "https://mirror.ravanertebat.ir/repository/golang-proxy,direct"
|
|
||||||
GOSUMDB: "sum.golang.org https://mirror.ravanertebat.ir/repository/golang-sum-proxy"
|
|
||||||
# GOINSECURE: "10.64.16.1"
|
|
||||||
# GOPRIVATE: "10.64.16.1"
|
|
||||||
settings:
|
|
||||||
debug: true
|
|
||||||
commands:
|
commands:
|
||||||
- |
|
- |
|
||||||
set -e
|
set -e
|
||||||
case "$DRONE_BRANCH" in
|
case "$DRONE_BRANCH" in
|
||||||
main) echo prod;;
|
main) echo prod;;
|
||||||
uat) echo uat;;
|
uat) echo uat;;
|
||||||
dev) echo dev;;
|
dev) echo dev;;
|
||||||
*) echo dev;;
|
*) echo dev;;
|
||||||
esac > .environment
|
esac > .environment
|
||||||
- echo "Branch ${DRONE_BRANCH}, Environment $(cat .environment)"
|
- echo "Branch ${DRONE_BRANCH}, Environment $(cat .environment)"
|
||||||
- APP_VERSION=$(cat .environment)-${DRONE_BUILD_NUMBER}
|
- APP_VERSION=$(cat .environment)-${DRONE_BUILD_NUMBER}
|
||||||
- echo "APP Version tags $APP_VERSION"
|
- echo "APP Version tag $APP_VERSION"
|
||||||
- echo -n "$APP_VERSION" >> .tags
|
- echo -n "$APP_VERSION" >> .tags
|
||||||
- mkdir -p ./artifacts/go/bin ./artifacts/go/config
|
- mkdir -p ./artifacts/go/bin ./artifacts/go/config
|
||||||
- go env
|
- go env
|
||||||
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./artifacts/go/bin/web ./cmd/web/main.go
|
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./artifacts/go/bin/web ./cmd/web/main.go
|
||||||
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./artifacts/go/bin/scraper ./cmd/scraper/main.go
|
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./artifacts/go/bin/scraper ./cmd/scraper/main.go
|
||||||
# Remove legacy worker sources if they linger on disk after git deleted them (AI pipeline owns scraping now).
|
|
||||||
- rm -f cmd/worker/workers/scraper.go cmd/worker/workers/scraper_consumer.go cmd/worker/workers/queue_producer.go
|
- rm -f cmd/worker/workers/scraper.go cmd/worker/workers/scraper_consumer.go cmd/worker/workers/queue_producer.go
|
||||||
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./artifacts/go/bin/worker ./cmd/worker/main.go
|
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./artifacts/go/bin/worker ./cmd/worker/main.go
|
||||||
- cp -r ./cmd/web/docs ./artifacts/go/bin/docs
|
- cp -r ./cmd/web/docs ./artifacts/go/bin/docs
|
||||||
- cp -r ./cmd/web/assets ./artifacts/go/bin/assets
|
- cp -r ./cmd/web/assets ./artifacts/go/bin/assets
|
||||||
- ls -ltrh ./artifacts/go/bin/
|
- ls -ltrh ./artifacts/go/bin/
|
||||||
|
|
||||||
- name: push scraper
|
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
|
||||||
debug: true
|
|
||||||
username: cicd
|
|
||||||
password:
|
|
||||||
from_secret: REGISTRY_PASSWORD
|
|
||||||
repo: artifactory.ravanertebat.ir/tm/scraper
|
|
||||||
registry: artifactory.ravanertebat.ir
|
|
||||||
dockerfile: ./cmd/scraper/Dockerfile
|
|
||||||
|
|
||||||
- name: push web
|
- name: push web
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
debug: true
|
registry: git.opplens.se
|
||||||
username: cicd
|
repo: git.opplens.se/mazyar/web
|
||||||
|
username:
|
||||||
|
from_secret: registry_username
|
||||||
password:
|
password:
|
||||||
from_secret: REGISTRY_PASSWORD
|
from_secret: registry_password
|
||||||
repo: artifactory.ravanertebat.ir/tm/web
|
|
||||||
registry: artifactory.ravanertebat.ir
|
|
||||||
dockerfile: ./cmd/web/Dockerfile
|
dockerfile: ./cmd/web/Dockerfile
|
||||||
# context: ./cmd/web
|
|
||||||
|
- name: push scraper
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
registry: git.opplens.se
|
||||||
|
repo: git.opplens.se/mazyar/scraper
|
||||||
|
username:
|
||||||
|
from_secret: registry_username
|
||||||
|
password:
|
||||||
|
from_secret: registry_password
|
||||||
|
dockerfile: ./cmd/scraper/Dockerfile
|
||||||
|
|
||||||
- name: push worker
|
- name: push worker
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
debug: true
|
registry: git.opplens.se
|
||||||
username: cicd
|
repo: git.opplens.se/mazyar/worker
|
||||||
|
username:
|
||||||
|
from_secret: registry_username
|
||||||
password:
|
password:
|
||||||
from_secret: REGISTRY_PASSWORD
|
from_secret: registry_password
|
||||||
repo: artifactory.ravanertebat.ir/tm/worker
|
|
||||||
registry: artifactory.ravanertebat.ir
|
|
||||||
dockerfile: ./cmd/worker/Dockerfile
|
dockerfile: ./cmd/worker/Dockerfile
|
||||||
node:
|
|
||||||
tag: aecde-docker-runner
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
branch:
|
||||||
- main
|
- main
|
||||||
- uat
|
- uat
|
||||||
- develop
|
- dev
|
||||||
event:
|
event:
|
||||||
- promote
|
- push
|
||||||
- custom
|
|
||||||
|
|||||||
Reference in New Issue
Block a user