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 # Internal endpoint of the Docker registry, where no authentication is necessary
registry_url := env_var_or_default('REGISTRY_URL', 'docker.io/') 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_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") 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_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') 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='': build context dockerfile='' image_target='' *args='':
fly -t {{target}} execute \ fly -t {{target}} execute \
--config=./tasks/build-image.yml \ --config=./tasks/build-image.yml \
@ -29,8 +19,6 @@ build context dockerfile='' image_target='' *args='':
-v context=repo/images/{{context}} \ -v context=repo/images/{{context}} \
-v dockerfile={{dockerfile}} \ -v dockerfile={{dockerfile}} \
-v target={{image_target}} \ -v target={{image_target}} \
-v registry_url={{registry_url}} \
-v 'buildkit_config={{buildkit_config}}' \
{{args}} {{args}}
make-pipeline file: make-pipeline file:
@ -38,19 +26,13 @@ make-pipeline file:
fly -t {{target}} validate-pipeline \ fly -t {{target}} validate-pipeline \
--strict \ --strict \
--config "{{file}}" \ --config "{{file}}" \
-v registry_url={{registry_url}} \ -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}}
set-pipeline: (make-pipeline pipeline_file) set-pipeline: (make-pipeline pipeline_file)
fly -t {{target}} set-pipeline \ fly -t {{target}} set-pipeline \
--pipeline {{pipeline_name}} \ --pipeline {{pipeline_name}} \
--config "{{pipeline_file}}" \ --config "{{pipeline_file}}" \
-v registry_url={{registry_url}} \ -v registry_url={{registry_url}} \
-v 'buildkit_config={{buildkit_config}}' \
-v forgejo_api_key={{forgejo_api_key}} \ -v forgejo_api_key={{forgejo_api_key}} \
-v forgejo_url={{forgejo_url}} \ -v forgejo_url={{forgejo_url}} \
-v repo_owner={{repo_owner}} \ -v repo_owner={{repo_owner}} \

View file

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

View file

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

View file

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

View file

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

View file

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