Compare commits
2 commits
6431c4c01e
...
3df40715b4
Author | SHA1 | Date | |
---|---|---|---|
3df40715b4 | |||
dae7318a7d |
6 changed files with 128 additions and 6 deletions
10
Justfile
10
Justfile
|
@ -3,7 +3,10 @@ target := 'main'
|
|||
|
||||
# Internal endpoint of the Docker registry, where no authentication is necessary
|
||||
registry_url := env_var_or_default('REGISTRY_URL', 'docker.io/')
|
||||
repo_url := shell("git remote get-url origin | sed 's|git@\\([^:]*\\):\\(.*\\).git|https://\\1/\\2|'")
|
||||
forgejo_api_key := env_var("FORGEJO_API_KEY")
|
||||
forgejo_url := shell("git remote get-url origin | sed 's|git@\\([^:]*\\):\\(.*\\).git|https://\\1/\\2|' | cut -d'/' -f-3")
|
||||
repo_owner := shell("git remote get-url origin | sed 's|git@\\([^:]*\\):\\(.*\\).git|https://\\1/\\2|' | cut -d'/' -f4")
|
||||
repo_name := shell("git remote get-url origin | sed 's|git@\\([^:]*\\):\\(.*\\).git|https://\\1/\\2|' | cut -d'/' -f5-")
|
||||
|
||||
pipeline_file := shell('mktemp')
|
||||
|
||||
|
@ -30,7 +33,10 @@ set-pipeline: (make-pipeline pipeline_file)
|
|||
--pipeline {{pipeline_name}} \
|
||||
--config "{{pipeline_file}}" \
|
||||
-v registry_url={{registry_url}} \
|
||||
-v repo_url={{repo_url}}
|
||||
-v forgejo_api_key={{forgejo_api_key}} \
|
||||
-v forgejo_url={{forgejo_url}} \
|
||||
-v repo_owner={{repo_owner}} \
|
||||
-v repo_name={{repo_name}}
|
||||
|
||||
validate:
|
||||
docker run --rm -v ./:/usr/src/app renovate/renovate renovate-config-validator --strict
|
||||
|
|
|
@ -30,6 +30,5 @@ ENV PATH=/home/runner/.local/bin:$PATH
|
|||
|
||||
COPY requirements.txt ./
|
||||
|
||||
RUN set -e; \
|
||||
pip install --user -r requirements.txt; \
|
||||
rm -r /home/runner/.cache;
|
||||
RUN --mount=type=cache,id=pip-cache,target=/home/runner/.cache/pip \
|
||||
pip install --user -r requirements.txt;
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
{%- import 'jobs/simple-image.yml.j2' as simple_image %}
|
||||
{%- macro simple_image_resource(name, registry_url) -%}
|
||||
- name: status-{{name}}
|
||||
type: gitea-status
|
||||
source:
|
||||
access_token: ((forgejo_api_key))
|
||||
url: ((forgejo_url))
|
||||
owner: ((repo_owner))
|
||||
name: ((repo_name))
|
||||
type: generic
|
||||
context: build/{{name}}
|
||||
description: Building image {{name}}
|
||||
|
||||
- name: image-{{ name }}
|
||||
type: registry-image
|
||||
icon: docker
|
||||
|
@ -15,12 +26,17 @@ resource_types:
|
|||
source:
|
||||
repository: concourse/github-release-resource
|
||||
|
||||
- name: gitea-status
|
||||
type: registry-image
|
||||
source:
|
||||
repository: ((registry_url))/gitea-status
|
||||
|
||||
resources:
|
||||
- name: repo
|
||||
type: git
|
||||
icon: github
|
||||
source:
|
||||
uri: ((repo_url))
|
||||
uri: ((forgejo_url))/((repo_owner))/((repo_name))
|
||||
branch: master
|
||||
|
||||
{%- set registry_url = "((registry_url))" %}
|
||||
|
@ -42,3 +58,5 @@ jobs:
|
|||
{{ job.jobs() }}
|
||||
{%- endif %}
|
||||
{% endfor %}
|
||||
|
||||
{# vim: ft=yaml-jinja #}
|
||||
|
|
|
@ -29,6 +29,17 @@
|
|||
{% endmacro %}
|
||||
|
||||
{% macro resources(registry_url) -%}
|
||||
- name: status-gitea
|
||||
type: gitea-status
|
||||
source:
|
||||
access_token: ((forgejo_api_key))
|
||||
url: ((forgejo_url))
|
||||
owner: ((repo_owner))
|
||||
name: ((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) }}
|
||||
|
@ -37,9 +48,33 @@
|
|||
{% macro jobs() -%}
|
||||
- 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') }}
|
||||
{{ build('status') }}
|
||||
{{ build('pr') }}
|
||||
|
@ -50,3 +85,4 @@
|
|||
{{ put('pr') }}
|
||||
{% endmacro %}
|
||||
|
||||
{# vim: ft=yaml-jinja #}
|
||||
|
|
|
@ -1,4 +1,15 @@
|
|||
{% macro resources(registry_url) -%}
|
||||
- name: status-rust-xwin
|
||||
type: gitea-status
|
||||
source:
|
||||
access_token: ((forgejo_api_key))
|
||||
url: ((forgejo_url))
|
||||
owner: ((repo_owner))
|
||||
name: ((repo_name))
|
||||
type: generic
|
||||
context: build/rust-xwin
|
||||
description: Building image rust-xwin
|
||||
|
||||
- name: image-rust-xwin
|
||||
type: registry-image
|
||||
icon: docker
|
||||
|
@ -17,9 +28,33 @@
|
|||
{% macro jobs() -%}
|
||||
- name: rust-xwin
|
||||
serial: true
|
||||
on_success:
|
||||
put: state-success
|
||||
resource: status-rust-xwin
|
||||
no_get: true
|
||||
params:
|
||||
state: success
|
||||
sha: ((.:git_sha))
|
||||
|
||||
on_failure:
|
||||
put: state-failure
|
||||
resource: status-rust-xwin
|
||||
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-rust-xwin
|
||||
no_get: true
|
||||
params:
|
||||
state: pending
|
||||
sha: ((.:git_sha))
|
||||
- task: build-rust-xwin
|
||||
file: repo/tasks/build-image.yml
|
||||
privileged: true
|
||||
|
@ -49,3 +84,5 @@
|
|||
params: { image: image-rust-xwin-ci/image.tar }
|
||||
no_get: true
|
||||
{% endmacro %}
|
||||
|
||||
{# vim: ft=yaml-jinja #}
|
||||
|
|
|
@ -1,9 +1,33 @@
|
|||
{% macro jobs(job) -%}
|
||||
- name: {{ job.name }}
|
||||
serial: true
|
||||
on_success:
|
||||
put: state-success
|
||||
resource: status-{{ job.name }}
|
||||
no_get: true
|
||||
params:
|
||||
state: success
|
||||
sha: ((.:git_sha))
|
||||
|
||||
on_failure:
|
||||
put: state-failure
|
||||
resource: status-{{ job.name }}
|
||||
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-{{ job.name }}
|
||||
no_get: true
|
||||
params:
|
||||
state: pending
|
||||
sha: ((.:git_sha))
|
||||
- task: build-image
|
||||
privileged: true
|
||||
file: repo/tasks/build-image.yml
|
||||
|
@ -22,3 +46,5 @@
|
|||
params: { image: image/image.tar }
|
||||
no_get: true
|
||||
{%- endmacro -%}
|
||||
|
||||
{# vim: ft=yaml-jinja #}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue