Drone: initial builds
continuous-integration/drone Build is failing Details

master
Garrett Mills 1 year ago
parent 1b1c1f5f5e
commit c1c768e8b3

@ -1,200 +1,47 @@
---
kind: pipeline kind: pipeline
name: default type: kubernetes
type: docker name: build
steps:
# ============ RESTORE CACHE ============= metadata:
# - name: restore node_modules cache labels:
# image: appleboy/drone-sftp-cache pod-security.kubernetes.io/audit: privileged
# settings:
# server: services:
# from_secret: cache_server - name: docker daemon
# port: 22 image: docker:dind
# username: privileged: true
# from_secret: cache_server_user environment:
# key: DOCKER_TLS_CERTDIR: ""
# from_secret: cache_server_key # when:
# path: /var/cache/drone # event:
# restore: true # - tag
# mount: # - promote
# - node_modules
# ============ BUILD STEPS =============== steps:
- name: build-prod - name: node.js build
image: glmdev/node-pnpm:latest image: node:18
commands: commands:
- pnpm i --silent - npm add --global pnpm
- pnpm i
- rm -f ./node_modules/ngx-monaco-editor/lib/monaco.d.ts - rm -f ./node_modules/ngx-monaco-editor/lib/monaco.d.ts
- sed -i '1d' ./node_modules/ngx-monaco-editor/lib/types.d.ts - sed -i '1d' ./node_modules/ngx-monaco-editor/lib/types.d.ts
- ./node_modules/.bin/ionic build --prod - ./node_modules/.bin/ionic build --prod
- ./node_modules/.bin/ngsw-config ./www/ ./ngsw-config.json /i - ./node_modules/.bin/ngsw-config ./www/ ./ngsw-config.json /i
- tar czf build.tar.gz www - echo -n $(uuidgen) | tee ./www/version.html
# =============== REBULD CACHE ==============
# - name: rebuild node_modules cache
# image: appleboy/drone-sftp-cache
# settings:
# server:
# from_secret: cache_server
# port: 22
# username:
# from_secret: cache_server_user
# key:
# from_secret: cache_server_key
# path: /var/cache/drone
# rebuild: true
# mount:
# - node_modules
# =============== RELEASE =============== - name: container build
- name: release image: docker:latest
image: plugins/gitea-release privileged: true
settings: commands:
api_key: - "while ! docker stats --no-stream; do sleep 1; done"
from_secret: gitea_api_key - docker image build -t $DOCKER_REGISTRY/noded/frontend .
base_url: https://code.garrettmills.dev - docker push $DOCKER_REGISTRY/noded/frontend
files: build.tar.gz environment:
title: ${DRONE_TAG} DOCKER_HOST: tcp://localhost:2375
when: DOCKER_REGISTRY:
event: tag from_secret: DOCKER_REGISTRY
# when:
# =============== DEPLOY TO DEV SITE =============== # event:
- name: copy artifacts to staging site # - tag
image: appleboy/drone-scp # - promote
settings:
host:
from_secret: dev_site_host
username:
from_secret: dev_site_user
key:
from_secret: dev_site_key
port: 22
source: build.tar.gz
target: /etc/glmdev/noded
when:
event: promote
target: staging
- name: deploy artifacts on staging site
image: appleboy/drone-ssh
settings:
host:
from_secret: dev_site_host
username:
from_secret: dev_site_user
key:
from_secret: dev_site_key
port: 22
script:
- cd /etc/glmdev/noded
- rm -rf www
- tar xzf build.tar.gz
- cd www
- echo -n "$(uuidgen)" | sudo tee version.html
when:
event: promote
target: staging
# =============== DEPLOY TO PROD SITE ===============
- name: copy artifacts to production site
image: appleboy/drone-scp
settings:
host:
from_secret: prod_site_host
username:
from_secret: prod_site_user
key:
from_secret: prod_site_key
port: 22
source: build.tar.gz
target: /etc/glmdev/noded-prod
when:
event: promote
target: production
- name: deploy artifacts on production site
image: appleboy/drone-ssh
settings:
host:
from_secret: prod_site_host
username:
from_secret: prod_site_user
key:
from_secret: prod_site_key
port: 22
script:
- cd /etc/glmdev/noded-prod
- rm -rf www
- tar xzf build.tar.gz
- cd www
- echo -n "$(uuidgen)" | sudo tee version.html
when:
event: promote
target: production
# =============== BUILD NOTIFICATIONS ===============
- name: send build success notifications
image: plugins/webhook
settings:
urls:
from_secret: notify_webhook_url
content_type: application/json
template: |
{
"title": "Drone-CI [noded-frontend @ ${DRONE_BUILD_NUMBER}]",
"message": "Build completed successfully. (Changes by ${DRONE_COMMIT_AUTHOR})",
"priority": 4
}
when:
status: success
event:
exclude:
- promote
- name: send build error notifications
image: plugins/webhook
settings:
urls:
from_secret: notify_webhook_url
content_type: application/json
template: |
{
"title": "Drone-CI [noded-frontend @ ${DRONE_BUILD_NUMBER}]",
"message": "Build failed! (Changes by ${DRONE_COMMIT_AUTHOR})",
"priority": 6
}
when:
status: failure
event:
exclude:
- promote
# =============== DEPLOY NOTIFICATIONS ===============
- name: send deploy success notifications
image: plugins/webhook
settings:
urls:
from_secret: notify_webhook_url
content_type: application/json
template: |
{
"title": "Drone-Deploy [noded-frontend @ ${DRONE_BUILD_NUMBER} to ${DRONE_DEPLOY_TO}]",
"message": "Deployment completed successfully. (Changes by ${DRONE_COMMIT_AUTHOR})",
"priority": 4
}
when:
status: success
event:
- promote
- name: send deploy error notifications
image: plugins/webhook
settings:
urls:
from_secret: notify_webhook_url
content_type: application/json
template: |
{
"title": "Drone-Deploy [noded-frontend @ ${DRONE_BUILD_NUMBER} to ${DRONE_DEPLOY_TO}]",
"message": "Deployment failed! (Changes by ${DRONE_COMMIT_AUTHOR})",
"priority": 6
}
when:
status: failure
event:
- promote

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save