94 lines
2.1 KiB
Markdown
94 lines
2.1 KiB
Markdown
# Getting started with running a Drone
|
|
https://blog.ruanbekker.com/blog/2021/03/09/cicd-with-droneci-and-gitea-using-docker-compose/
|
|
https://docs.drone.io/server/provider/gitea/
|
|
|
|
|
|
# CI CD Pipelines
|
|
## From https://www.youtube.com/watch?v=PXM63rU7NJ4
|
|
kind: pipeline
|
|
type: docker
|
|
name: sshd-base
|
|
|
|
trigger:
|
|
branch:
|
|
- main
|
|
event:
|
|
- push
|
|
|
|
image_pull_secrets:
|
|
- global_dockerconfig
|
|
|
|
## Cloning https://docs.drone.io/pipeline/digitalocean/syntax/cloning/
|
|
token:
|
|
from_secret: token
|
|
|
|
clone:
|
|
depth: 50
|
|
|
|
## Hello World Step
|
|
# steps:
|
|
# - name: say-hello
|
|
# image: busybox
|
|
# commands:
|
|
# - echo hello-world
|
|
|
|
## Steps https://docs.drone.io/pipeline/digitalocean/syntax/steps/
|
|
steps:
|
|
## Submodules --recursive flag https://docs.drone.io/pipeline/digitalocean/syntax/cloning/#the---recursive-flag
|
|
- name: submodules
|
|
commands:
|
|
- git submodule update --recursive --remote
|
|
|
|
## Basic Docker In Docker Example https://docs.drone.io/pipeline/docker/examples/services/docker_dind/
|
|
## TRUSTED REPOS ONLY DUE TO ROOT POWERS ##
|
|
- name: test
|
|
image: docker:dind
|
|
volumes:
|
|
- name: dockersock
|
|
path: /var/run
|
|
commands:
|
|
- sleep 5 # give docker enough time to start
|
|
- docker ps -a
|
|
- docker compose build
|
|
- docker compose push
|
|
|
|
services:
|
|
- name: docker
|
|
image: docker:dind
|
|
privileged: true
|
|
volumes:
|
|
- name: dockersock
|
|
path: /var/run
|
|
|
|
volumes:
|
|
- name: dockersock
|
|
temp: {}
|
|
|
|
## Random build step for examples
|
|
- name: build
|
|
image: git.nixc.us/colin/sshd-base:latest
|
|
commands:
|
|
- echo hello-world
|
|
## Conditions https://docs.drone.io/pipeline/digitalocean/syntax/conditions/
|
|
when:
|
|
branch:
|
|
- main
|
|
- staging
|
|
- production
|
|
|
|
- name: publish
|
|
image: plugins/docker
|
|
settings:
|
|
username: colin
|
|
password:
|
|
from_secret: colin_docker_password
|
|
repo: git.nixc.us/colin/sshd-base:latest
|
|
tags:
|
|
- 1.0.0
|
|
- 1.0
|
|
## Parallelism https://docs.drone.io/pipeline/digitalocean/syntax/parallelism/
|
|
depends_on:
|
|
- build
|
|
|
|
## Build docker image and re-use in the next step
|
|
https://discourse.drone.io/t/build-docker-image-and-re-use-in-the-next-step/6190 |