1
Fork 0
ci-images/pipelines/jobs/gitea.yml.j2
2024-08-28 11:51:27 +02:00

89 lines
2.2 KiB
Django/Jinja

{% macro resource(variant, registry_url) -%}
- name: image-gitea-{{ variant }}
type: registry-image
icon: docker
source:
repository: "{{ registry_url }}/gitea-{{ variant }}"
tag: latest
{% endmacro %}
{% macro build(variant, registry_url) -%}
- task: build-gitea-{{ variant }}
file: repo/tasks/build-image.yml
privileged: true
vars:
context: repo/images/gitea
target: ''
dockerfile: ''
params:
BUILD_ARG_VARIANT: {{ variant }}
REGISTRY_MIRRORS: {{ registry_url }}
output_mapping:
image: image-gitea-{{ variant }}
{% endmacro %}
{% macro put(variant) -%}
- put: image-gitea-{{ variant }}
inputs: detect
params: { image: image-gitea-{{ variant }}/image.tar }
no_get: true
{% endmacro %}
{% macro resources(registry_url) -%}
- name: status-gitea
type: gitea-status
source:
access_token: ((forgejo_api_key))
url: ((forgejo_url))
owner: ((repo_owner))
repo: ((repo_name))
type: generic
context: build/gitea
description: Building images gitea-package, gitea-pr, gitea-status
{{ resource('package', registry_url) }}
{{ resource('status', registry_url) }}
{{ resource('pr', registry_url) }}
{% endmacro %}
{% macro jobs(registry_url) -%}
- name: gitea
serial: true
on_success:
put: state-success
resource: status-gitea
no_get: true
params:
state: success
sha: ((.:git_sha))
on_failure:
put: state-failure
resource: status-gitea
no_get: true
params:
state: failure
sha: ((.:git_sha))
plan:
- get: repo
trigger: true
- load_var: git_sha
file: repo/.git/ref
- put: state-pending
resource: status-gitea
no_get: true
params:
state: pending
sha: ((.:git_sha))
{{ build('package', registry_url) }}
{{ build('status', registry_url) }}
{{ build('pr', registry_url) }}
- in_parallel:
steps:
{{ put('package') }}
{{ put('status') }}
{{ put('pr') }}
{% endmacro %}
{# vim: ft=yaml-jinja #}