Create .drone.yml
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is failing Details

This commit is contained in:
nemunaire 2022-09-05 00:59:31 +02:00
parent e7bb98261f
commit 924e79b2c9
2 changed files with 117 additions and 0 deletions

22
.drone-manifest.yml Normal file
View File

@ -0,0 +1,22 @@
image: registry.nemunai.re/atsebay.t-worker:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
{{#if build.tags}}
tags:
{{#each build.tags}}
- {{this}}
{{/each}}
{{/if}}
manifests:
- image: registry.nemunai.re/atsebay.t-worker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
platform:
architecture: amd64
os: linux
- image: registry.nemunai.re/atsebay.t-worker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
platform:
architecture: arm64
os: linux
variant: v8
- image: registry.nemunai.re/atsebay.t-worker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
platform:
architecture: arm
os: linux
variant: v7

95
.drone.yml Normal file
View File

@ -0,0 +1,95 @@
---
kind: pipeline
type: docker
name: build-arm64
platform:
os: linux
arch: arm64
steps:
- name: build container
image: plugins/docker
settings:
registry: registry.nemunai.re
repo: registry.nemunai.re/atsebay.t-worker
auto_tag: true
auto_tag_suffix: ${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}
username:
from_secret: docker_username
password:
from_secret: docker_password
trigger:
event:
- cron
- push
- tag
---
kind: pipeline
name: docker-manifest
steps:
- name: publish
image: plugins/manifest
settings:
auto_tag: true
ignore_missing: true
spec: .drone-manifest.yml
username:
from_secret: docker_username
password:
from_secret: docker_password
trigger:
event:
- cron
- push
- tag
depends_on:
- build-arm64
---
kind: pipeline
type: docker
name: student submission
platform:
os: linux
arch: arm64
workspace:
path: /work
steps:
- name: extract submission
image: registry.nemunai.re/atsebay.t-worker
environment:
SSH_PRIVATE_KEY:
from_secret: SSH_PRIVATE_KEY
commands:
- mkdir ~/.ssh && chmod 750 ~/.ssh
- echo "$${SSH_PRIVATE_KEY}" > ~/.ssh/id_ed25519
- chmod 600 ~/.ssh/id_ed25519
- echo -e "Host *\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- git clone --depth 1 --branch $$(git ls-remote --tags "${REPO_URL}" | grep "refs/tags/${REPO_TAG}" | tail -n 1 | sed 's@/@ @;s@/@ @' | awk '{ print $$4 }') ${REPO_URL} "/work/${LOGIN}"
- tar cJf "/work/rendu-${LOGIN}.tar.xz" --exclude-vcs -C /work "${LOGIN}/"
- "echo -e '{\"filename\": \"rendu-${LOGIN}.tar.xz\", \"size\": '$$(du -s ${LOGIN}/ | awk \'{ print $1 }\')', \"date_now\": \"'$$(date -Iseconds)'\", \"date\": \"'$$(git -C \'/work/${LOGIN}\' log -1 --format=%cd --date=iso-strict)'\", \"tag\": \"'$(git -C \'/work/${LOGIN}\' describe --tags)'\", \"commit\": \"'$$(git -C \'/work/${LOGIN}\' rev-parse HEAD)'\"}' >> /work/rendu-${LOGIN}.metadata"
- "[ -x \"checks-${DEST}.sh\" ] && \"./checks-${DEST}.sh\" '/work/${LOGIN}/' > /work/rendu-${LOGIN}.checks || true"
- name: upload on s3
image: plugins/s3
settings:
endpoint: https://storage.nemunai.re
path_style: true
bucket: epita-rendus
access_key:
from_secret: s3_access_key
secret_key:
from_secret: s3_secret_key
source: rendu-${LOGIN}.*
target: /${DEST//\//-}
trigger:
event:
- custom