2023-08-02 14:39:15 +02:00
|
|
|
kind: pipeline
|
|
|
|
name: default
|
|
|
|
type: docker
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: build ci
|
|
|
|
image: rustlang/rust:nightly
|
2023-08-03 23:48:18 +02:00
|
|
|
volumes:
|
|
|
|
- name: ci
|
2023-08-04 00:08:16 +02:00
|
|
|
path: /mnt/ci
|
2023-08-04 00:02:13 +02:00
|
|
|
environment:
|
|
|
|
PKG_CONFIG_SYSROOT_DIR: "/"
|
2023-08-04 00:12:05 +02:00
|
|
|
CI_PREFIX: "/mnt/ci"
|
2023-08-02 14:39:15 +02:00
|
|
|
commands:
|
2023-08-02 14:40:58 +02:00
|
|
|
- set -e
|
2023-08-03 23:55:22 +02:00
|
|
|
- apt update
|
2023-08-04 00:13:30 +02:00
|
|
|
- apt install musl-tools pkg-config libssl-dev openssl build-essential musl-dev -y
|
|
|
|
- rustup target add x86_64-unknown-linux-musl
|
|
|
|
- cargo build --target=x86_64-unknown-linux-musl -p ci
|
|
|
|
#- cargo build -p ci
|
|
|
|
- mv target/x86_64-unknown-linux-musl/debug/ci "$CI_PREFIX/ci"
|
|
|
|
#- mv target/debug/ci $CI_PREFIX/ci
|
2023-08-03 23:48:18 +02:00
|
|
|
|
2023-08-02 14:39:15 +02:00
|
|
|
- name: load_secret
|
|
|
|
image: debian:buster-slim
|
|
|
|
volumes:
|
|
|
|
- name: ssh
|
|
|
|
path: /root/.ssh/
|
|
|
|
environment:
|
|
|
|
SSH_KEY:
|
|
|
|
from_secret: gitea_id_ed25519
|
|
|
|
commands:
|
|
|
|
- mkdir -p $HOME/.ssh/
|
|
|
|
- echo "$SSH_KEY" | base64 -d > $HOME/.ssh/id_ed25519
|
|
|
|
|
2023-08-03 23:36:06 +02:00
|
|
|
- name: build pr
|
2023-08-02 14:39:15 +02:00
|
|
|
image: kasperhermansen/cuddle:latest
|
|
|
|
pull: always
|
|
|
|
volumes:
|
|
|
|
- name: ssh
|
|
|
|
path: /root/.ssh/
|
|
|
|
- name: dockersock
|
|
|
|
path: /var/run
|
|
|
|
commands:
|
|
|
|
- eval `ssh-agent`
|
|
|
|
- chmod -R 600 ~/.ssh
|
|
|
|
- ssh-add
|
2023-08-04 00:17:25 +02:00
|
|
|
- echo "$DOCKER_PASSWORD" | docker login --password-stdin --username="$DOCKER_USERNAME" docker.io
|
2023-08-03 23:36:06 +02:00
|
|
|
- cuddle x ci:pr
|
2023-08-02 14:39:15 +02:00
|
|
|
environment:
|
|
|
|
DOCKER_BUILDKIT: 1
|
2023-08-04 00:17:25 +02:00
|
|
|
DOCKER_PASSWORD:
|
|
|
|
from_secret: docker_password
|
|
|
|
DOCKER_USERNAME:
|
|
|
|
from_secret: docker_username
|
2023-08-02 14:39:15 +02:00
|
|
|
CUDDLE_SECRETS_PROVIDER: 1password
|
|
|
|
CUDDLE_ONE_PASSWORD_DOT_ENV: ".env.ci"
|
|
|
|
CUDDLE_SSH_AGENT: "true"
|
2023-08-03 23:39:26 +02:00
|
|
|
CUDDLE_CI: "true"
|
2023-08-03 23:40:50 +02:00
|
|
|
CUDDLE_PLEASE_TOKEN:
|
|
|
|
from_secret: cuddle_please_token
|
2023-08-02 14:39:15 +02:00
|
|
|
OP_SERVICE_ACCOUNT_TOKEN:
|
|
|
|
from_secret: op_service_account_token
|
2023-08-03 23:36:06 +02:00
|
|
|
when:
|
|
|
|
event:
|
|
|
|
- pull_request
|
2023-08-02 14:39:15 +02:00
|
|
|
depends_on:
|
|
|
|
- "load_secret"
|
|
|
|
- "build ci"
|
|
|
|
|
|
|
|
- name: build main
|
|
|
|
image: kasperhermansen/cuddle:latest
|
|
|
|
pull: always
|
|
|
|
volumes:
|
|
|
|
- name: ssh
|
|
|
|
path: /root/.ssh/
|
|
|
|
- name: dockersock
|
|
|
|
path: /var/run
|
2023-08-03 23:48:18 +02:00
|
|
|
- name: ci
|
2023-08-04 00:08:16 +02:00
|
|
|
path: /mnt/ci
|
2023-08-02 14:39:15 +02:00
|
|
|
commands:
|
|
|
|
- eval `ssh-agent`
|
|
|
|
- chmod -R 600 ~/.ssh
|
|
|
|
- ssh-add
|
2023-08-04 00:20:16 +02:00
|
|
|
- echo "$DOCKER_PASSWORD" | docker login --password-stdin --username="$DOCKER_USERNAME" docker.io
|
2023-08-04 00:10:05 +02:00
|
|
|
- ldd $CI_PREFIX
|
2023-08-04 00:31:57 +02:00
|
|
|
- apt install git
|
2023-08-03 23:36:06 +02:00
|
|
|
- cuddle x ci:main
|
2023-08-02 14:39:15 +02:00
|
|
|
environment:
|
|
|
|
DOCKER_BUILDKIT: 1
|
2023-08-04 00:20:16 +02:00
|
|
|
DOCKER_PASSWORD:
|
|
|
|
from_secret: docker_password
|
|
|
|
DOCKER_USERNAME:
|
|
|
|
from_secret: docker_username
|
2023-08-02 14:39:15 +02:00
|
|
|
CUDDLE_SECRETS_PROVIDER: 1password
|
|
|
|
CUDDLE_ONE_PASSWORD_DOT_ENV: ".env.ci"
|
|
|
|
CUDDLE_SSH_AGENT: "true"
|
2023-08-04 00:08:16 +02:00
|
|
|
CI_PREFIX: "/mnt/ci/ci"
|
2023-08-03 23:40:50 +02:00
|
|
|
CUDDLE_PLEASE_TOKEN:
|
|
|
|
from_secret: cuddle_please_token
|
2023-08-02 14:39:15 +02:00
|
|
|
OP_SERVICE_ACCOUNT_TOKEN:
|
|
|
|
from_secret: op_service_account_token
|
|
|
|
when:
|
|
|
|
branch:
|
|
|
|
- main
|
|
|
|
- master
|
|
|
|
depends_on:
|
2023-08-03 23:48:18 +02:00
|
|
|
- "load_secret"
|
2023-08-03 23:36:06 +02:00
|
|
|
- "build ci"
|
2023-08-02 14:39:15 +02:00
|
|
|
|
|
|
|
- name: deploy release
|
|
|
|
image: kasperhermansen/cuddle:latest
|
|
|
|
pull: always
|
|
|
|
volumes:
|
|
|
|
- name: ssh
|
|
|
|
path: /root/.ssh/
|
|
|
|
- name: dockersock
|
|
|
|
path: /var/run
|
|
|
|
commands:
|
|
|
|
- eval `ssh-agent`
|
|
|
|
- chmod -R 600 ~/.ssh
|
|
|
|
- ssh-add
|
|
|
|
- cuddle x build:release:all
|
|
|
|
- cuddle x deploy:docs:preview
|
|
|
|
environment:
|
|
|
|
DOCKER_BUILDKIT: 1
|
|
|
|
CUDDLE_SECRETS_PROVIDER: 1password
|
|
|
|
CUDDLE_ONE_PASSWORD_DOT_ENV: ".env.ci"
|
|
|
|
CUDDLE_SSH_AGENT: "true"
|
2023-08-03 23:39:26 +02:00
|
|
|
CUDDLE_CI: "true"
|
2023-08-03 23:40:50 +02:00
|
|
|
CUDDLE_PLEASE_TOKEN:
|
|
|
|
from_secret: cuddle_please_token
|
2023-08-02 14:39:15 +02:00
|
|
|
OP_SERVICE_ACCOUNT_TOKEN:
|
|
|
|
from_secret: op_service_account_token
|
|
|
|
when:
|
|
|
|
ref:
|
|
|
|
include:
|
|
|
|
- refs/tags/v**
|
|
|
|
depends_on:
|
|
|
|
- "load_secret"
|
|
|
|
- "build ci"
|
|
|
|
|
|
|
|
services:
|
|
|
|
- name: docker
|
|
|
|
image: docker:dind
|
|
|
|
privileged: true
|
|
|
|
volumes:
|
|
|
|
- name: dockersock
|
|
|
|
path: /var/run
|
|
|
|
|
|
|
|
volumes:
|
|
|
|
- name: ssh
|
|
|
|
temp: {}
|
|
|
|
- name: dockersock
|
2023-08-03 23:48:18 +02:00
|
|
|
temp: {}
|
|
|
|
- name: ci
|
2023-08-02 14:39:15 +02:00
|
|
|
temp: {}
|