Add optional pre and post commands
continuous-integration/drone/push Build is failing Details

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

View File

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

View File

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