Add optional pre and post commands
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
sfigato 2021-02-23 16:04:26 +01:00
parent 20b1996574
commit 54085de9bf
Signed by: blallo
GPG Key ID: 0CBE577C9B72DC3F
3 changed files with 49 additions and 40 deletions

View File

@ -112,6 +112,7 @@ steps:
pull: if-not-exists
image: leophys/pikaur:0.3
commands:
- git config --global http.version HTTP/1.1
- |
if [ -f /output/lock ]; then
while [ -f /output/lock ]; do
@ -457,6 +458,6 @@ depends_on:
- discord_arch_electron
---
kind: signature
hmac: de2ac2ab72e66acdc837d112e0811a19135987447219b04eef63879d86e0a9ef
hmac: cf54958f9a7bb4288eac6bf65ba6525f7fd4d38f9e384f3555caa99ed845b8b0
...

View File

@ -5,5 +5,7 @@ pikaur_version: "0.3"
user_uid: 1000
user_gid: 33
pkgs:
- electron-ozone
- discord_arch_electron
- name: electron-ozone
pre_cmd:
- git config --global http.version HTTP/1.1
- name: discord_arch_electron

View File

@ -30,7 +30,7 @@ volumes:
---
kind: pipeline
type: docker
name: {{ pkg }}
name: {{ pkg.name }}
platform:
os: linux
@ -40,7 +40,7 @@ workspace:
path: /drone
steps:
- name: cache-init_{{ pkg }}
- name: cache-init_{{ pkg.name }}
pull: if-not-exists
image: leophys/pikaur:{{ pikaur_version }}
user: root
@ -72,20 +72,20 @@ steps:
fi
- chmod a+rw /output
volumes:
- name: build_{{ pkg }}
- name: build_{{ pkg.name }}
path: /build2
- name: etc_{{ pkg }}
- name: etc_{{ pkg.name }}
path: /cache_stage/etc
- name: opt_{{ pkg }}
- name: opt_{{ pkg.name }}
path: /cache_stage/opt
- name: var_{{ pkg }}
- name: var_{{ pkg.name }}
path: /cache_stage/var
- name: usr_{{ pkg }}
- name: usr_{{ pkg.name }}
path: /cache_stage/usr
- name: output
path: /output
- name: cache-acl_{{ pkg }}
- name: cache-acl_{{ pkg.name }}
pull: if-not-exists
image: leophys/pikaur:{{ pikaur_version }}
user: root
@ -97,21 +97,24 @@ steps:
- setfacl --restore=/build/permissions.acl
- chown -R {{ user_uid }}:{{ user_gid }} /build
volumes:
- name: build_{{ pkg }}
- name: build_{{ pkg.name }}
path: /build
- name: etc_{{ pkg }}
- name: etc_{{ pkg.name }}
path: /etc
- name: opt_{{ pkg }}
- name: opt_{{ pkg.name }}
path: /opt
- name: var_{{ pkg }}
- name: var_{{ pkg.name }}
path: /var
- name: usr_{{ pkg }}
- name: usr_{{ pkg.name }}
path: /usr
- name: build_{{ pkg }}
- name: build_{{ pkg.name }}
pull: if-not-exists
image: leophys/pikaur:{{ pikaur_version }}
commands:
{%- for cmd in pkg.pre_cmd|default([]) %}
- {{ cmd }}
{%- endfor %}
- |
if [ -f /output/lock ]; then
while [ -f /output/lock ]; do
@ -119,44 +122,47 @@ steps:
echo "Waiting $(cat /output/lock)"
done
else
echo "{{ pkg }}" >> /output/lock
echo "{{ pkg.name }}" >> /output/lock
fi
- |
set -euo pipefail
cd /build
/usr/bin/pikaur -G --noconfirm {{ pkg }} 2>&1|tee /output/{{ pkg }}.log
/usr/bin/pikaur -Py --keepbuilddeps --noconfirm {{ pkg }}/PKGBUILD 2>&1|tee /output/{{ pkg }}.log
/usr/bin/pikaur -G --noconfirm {{ pkg.name }} 2>&1|tee /output/{{ pkg.name }}.log
/usr/bin/pikaur -Py --keepbuilddeps --noconfirm {{ pkg.name }}/PKGBUILD 2>&1|tee /output/{{ pkg.name }}.log
{%- for cmd in pkg.post_cmd|default([]) %}
- {{ cmd }}
{%- endfor %}
- rm -f /output/lock
volumes:
- name: build_{{ pkg }}
- name: build_{{ pkg.name }}
path: /build
- name: etc_{{ pkg }}
- name: etc_{{ pkg.name }}
path: /etc
- name: opt_{{ pkg }}
- name: opt_{{ pkg.name }}
path: /opt
- name: var_{{ pkg }}
- name: var_{{ pkg.name }}
path: /var
- name: usr_{{ pkg }}
- name: usr_{{ pkg.name }}
path: /usr
- name: output
path: /output
volumes:
- name: build_{{ pkg }}
- name: build_{{ pkg.name }}
host:
path: {{ base_path }}/{{ pkg }}
- name: etc_{{ pkg }}
path: {{ base_path }}/{{ pkg.name }}
- name: etc_{{ pkg.name }}
host:
path: {{ base_path }}/etc/{{ pkg }}
- name: opt_{{ pkg }}
path: {{ base_path }}/etc/{{ pkg.name }}
- name: opt_{{ pkg.name }}
host:
path: {{ base_path }}/opt/{{ pkg }}
- name: var_{{ pkg }}
path: {{ base_path }}/opt/{{ pkg.name }}
- name: var_{{ pkg.name }}
host:
path: {{ base_path }}/var/{{ pkg }}
- name: usr_{{ pkg }}
path: {{ base_path }}/var/{{ pkg.name }}
- name: usr_{{ pkg.name }}
host:
path: {{ base_path }}/usr/{{ pkg }}
path: {{ base_path }}/usr/{{ pkg.name }}
- name: output
host:
path: {{ base_path }}/output
@ -174,7 +180,7 @@ depends_on:
---
kind: pipeline
type: docker
name: notify_failure-{{ pkg }}
name: notify_failure-{{ pkg.name }}
clone:
disable: true
@ -194,9 +200,9 @@ steps:
from_secret: m_from
M_TO:
from_secret: m_to
M_SUB: "[{{ pkg }}] FAILURE"
M_SUB: "[{{ pkg.name }}] FAILURE"
commands:
- /sendmail.sh /output/{{ pkg }}.log
- /sendmail.sh /output/{{ pkg.name }}.log
volumes:
- name: output
path: /output
@ -221,7 +227,7 @@ trigger:
- failure
depends_on:
- {{ pkg }}
- {{ pkg.name }}
{% endfor %}
@ -257,5 +263,5 @@ trigger:
depends_on:
{%- for pkg in pkgs %}
- {{ pkg }}
- {{ pkg.name }}
{%- endfor %}