1
Fork 0

Compare commits

..

No commits in common. "6d035411c6e89eed7dd64cc42befe4720fdf0bcf" and "c88442720c261b64c7b8e4ce8f15a0f555049e34" have entirely different histories.

6 changed files with 17 additions and 43 deletions

View file

@ -3,7 +3,6 @@ target := 'main'
# Internal endpoint of the Docker registry, where no authentication is necessary
registry_url := env_var_or_default('REGISTRY_URL', 'docker.io/')
registry_mirror_url := env_var_or_default('REGISTRY_MIRROR_URL', '')
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")
@ -11,15 +10,6 @@ repo_name := shell("git remote get-url origin | sed 's|git@\\([^:]*\\):\\(.*\\).
pipeline_file := shell('mktemp')
buildkit_config_tmpl := '''
[registry."docker.io"]
mirrors = ["{{registry_mirror_url}}"]
[registry."{{registry_mirror_url}}"]
http = true
'''
buildkit_config := replace(buildkit_config_tmpl, "{{registry_mirror_url}}", registry_mirror_url)
build context dockerfile='' image_target='' *args='':
fly -t {{target}} execute \
--config=./tasks/build-image.yml \
@ -29,8 +19,6 @@ build context dockerfile='' image_target='' *args='':
-v context=repo/images/{{context}} \
-v dockerfile={{dockerfile}} \
-v target={{image_target}} \
-v registry_url={{registry_url}} \
-v 'buildkit_config={{buildkit_config}}' \
{{args}}
make-pipeline file:
@ -38,19 +26,13 @@ make-pipeline file:
fly -t {{target}} validate-pipeline \
--strict \
--config "{{file}}" \
-v registry_url={{registry_url}} \
-v 'buildkit_config={{buildkit_config}}' \
-v forgejo_api_key={{forgejo_api_key}} \
-v forgejo_url={{forgejo_url}} \
-v repo_owner={{repo_owner}} \
-v repo_name={{repo_name}}
-v registry_url={{registry_url}}
set-pipeline: (make-pipeline pipeline_file)
fly -t {{target}} set-pipeline \
--pipeline {{pipeline_name}} \
--config "{{pipeline_file}}" \
-v registry_url={{registry_url}} \
-v 'buildkit_config={{buildkit_config}}' \
-v forgejo_api_key={{forgejo_api_key}} \
-v forgejo_url={{forgejo_url}} \
-v repo_owner={{repo_owner}} \

View file

@ -1,5 +1,5 @@
{%- import 'jobs/simple-image.yml.j2' as simple_image %}
{%- macro simple_image_resource(name) -%}
{%- macro simple_image_resource(name, registry_url) -%}
- name: status-{{name}}
type: gitea-status
source:
@ -15,7 +15,7 @@
type: registry-image
icon: docker
source:
repository: "((registry_url))/{{ name }}"
repository: "{{ registry_url }}/{{ name }}"
tag: latest
{% endmacro -%}
---
@ -39,12 +39,13 @@ resources:
uri: ((forgejo_url))/((repo_owner))/((repo_name))
branch: master
{%- set registry_url = "((registry_url))" %}
{% for img in images -%}
{%- if img.type == "simple" %}
{{ simple_image_resource(img.name) }}
{{ simple_image_resource(img.name, registry_url) }}
{%- elif img.type == "file" %}
{%- import "jobs/" + img.name + ".yml.j2" as job %}
{{ job.resources() }}
{{ job.resources(registry_url) }}
{%- endif %}
{%- endfor %}

View file

@ -1,9 +1,9 @@
{% macro resource(variant) -%}
{% macro resource(variant, registry_url) -%}
- name: image-gitea-{{ variant }}
type: registry-image
icon: docker
source:
repository: "((registry_url))/gitea-{{ variant }}"
repository: "{{ registry_url }}/gitea-{{ variant }}"
tag: latest
{% endmacro %}
@ -15,8 +15,6 @@
context: repo/images/gitea
target: ''
dockerfile: ''
registry_url: "((registry_url))"
buildkit_config: "((buildkit_config))"
params:
BUILD_ARG_VARIANT: {{ variant }}
output_mapping:
@ -30,7 +28,7 @@
no_get: true
{% endmacro %}
{% macro resources() -%}
{% macro resources(registry_url) -%}
- name: status-gitea
type: gitea-status
source:
@ -42,12 +40,12 @@
context: build/gitea
description: Building images gitea-package, gitea-pr, gitea-status
{{ resource('package') }}
{{ resource('status') }}
{{ resource('pr') }}
{{ resource('package', registry_url) }}
{{ resource('status', registry_url) }}
{{ resource('pr', registry_url) }}
{% endmacro %}
{% macro jobs(registry_url) -%}
{% macro jobs() -%}
- name: gitea
serial: true
on_success:

View file

@ -1,4 +1,4 @@
{% macro resources() -%}
{% macro resources(registry_url) -%}
- name: status-rust-xwin
type: gitea-status
source:
@ -14,14 +14,14 @@
type: registry-image
icon: docker
source:
repository: "((registry_url))/rust-xwin"
repository: "{{ registry_url }}/rust-xwin"
tag: latest
- name: image-rust-xwin-ci
type: registry-image
icon: docker
source:
repository: "((registry_url))/rust-xwin-ci"
repository: "{{ registry_url }}/rust-xwin-ci"
tag: latest
{% endmacro %}
@ -62,8 +62,6 @@
context: repo/images/rust-xwin
target: rust-xwin
dockerfile: ''
registry_url: "((registry_url))"
buildkit_config: "((buildkit_config))"
output_mapping:
image: image-rust-xwin
- task: build-rust-xwin-ci
@ -73,8 +71,6 @@
context: repo/images/rust-xwin
target: rust-xwin-ci
dockerfile: ''
registry_url: "((registry_url))"
buildkit_config: "((buildkit_config))"
output_mapping:
image: image-rust-xwin-ci
- in_parallel:

View file

@ -35,8 +35,6 @@
context: repo/images/{{ job.name }}
dockerfile: ''
target: ''
registry_url: "((registry_url))"
buildkit_config: "((buildkit_config))"
{%- if "args" in job %}
params:
{%- for name, value in job.args.items() %}

View file

@ -6,7 +6,7 @@ image_resource:
name: image
type: registry-image
source:
repository: ((registry_url))/oci-build-task
repository: concourse/oci-build-task
tag: latest
inputs:
@ -23,7 +23,6 @@ params:
CONTEXT: ((context))
DOCKERFILE: ((dockerfile))
TARGET: ((target))
BUILDKIT_EXTRA_CONFIG: ((buildkit_config))
run:
path: build