Skip to content

Commit

Permalink
Merge pull request #124 from linkorb/extra-docker-build-args-8559
Browse files Browse the repository at this point in the history
feat: make docker build args extensible #8559
  • Loading branch information
mhitza authored Feb 10, 2025
2 parents a385503 + e7ceedd commit 08c858c
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ your repository.
| github<br>features<br>wiki `boolean` |false| Enable Wiki tab.|
| github<br>features<br>issues `boolean` |false| Enable issues tab.|
| github<br>features<br>projects `boolean` |false| Enable projects tab.|
| github_workflows<br>build<br>extra_docker_build_args `object` |{}| Key-value pairs to use as build args during the docker build step of build and release workflow|
| reviewdog<br>platforms `array` |[]| A broad way to categorize programming languages, libraries, and frameworks, and for which we have an external tool we can use to assure code quality during review.&nbsp; Accepted values:`php`,`twig`,||
| devcontainer<br>custom_docker_compose_yaml `boolean` |false| When enabled the compose file located at .devcontainer/docker-compose.yaml will no longer get automatically updated. Allowing users to customize their docker-compose setup.|
| devcontainer<br>postCreateCommand `string` |-| Additional (shell) commands to run when the containers is created. For a typical project you would specify commands that only need to run once when the project is setup. For example you might add a command in here to load database fixtures for your project.|
Expand Down
1 change: 1 addition & 0 deletions docs/partials/readme.configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
| github<br>features<br>wiki `boolean` |false| Enable Wiki tab.|
| github<br>features<br>issues `boolean` |false| Enable issues tab.|
| github<br>features<br>projects `boolean` |false| Enable projects tab.|
| github_workflows<br>build<br>extra_docker_build_args `object` |{}| Key-value pairs to use as build args during the docker build step of build and release workflow|
| reviewdog<br>platforms `array` |[]| A broad way to categorize programming languages, libraries, and frameworks, and for which we have an external tool we can use to assure code quality during review.&nbsp; Accepted values:`php`,`twig`,||
| devcontainer<br>custom_docker_compose_yaml `boolean` |false| When enabled the compose file located at .devcontainer/docker-compose.yaml will no longer get automatically updated. Allowing users to customize their docker-compose setup.|
| devcontainer<br>postCreateCommand `string` |-| Additional (shell) commands to run when the containers is created. For a typical project you would specify commands that only need to run once when the project is setup. For example you might add a command in here to load database fixtures for your project.|
Expand Down
7 changes: 7 additions & 0 deletions group_vars/all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,10 @@ default_devcontainer_customizations_vscode:
- repo.yaml
# YAML extension by RedHat that prompts on each new devcontainer to enable telemetry
"redhat.telemetry.enabled": false

default_docker_build_args:
PACKAGIST_USER: token
PACKAGIST_TOKEN: "{{ '${{ secrets.PACKAGIST_TOKEN }}' }}"
# XXX we need this intricate value escaping in here, because Ansible will try to evaluate the value when we
# merge this default with any user provided build args. Since GitHub workflow secrets look very much like Jinja2
# template interpolation, playbook will fail.
16 changes: 16 additions & 0 deletions repo.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,22 @@ properties:
type: boolean
default: false

github_workflows:
type: object
additionalProperties: false
description: EXPERIMENTAL configuration options for the optionally generated GitHub workflows (sdlc_workflows)
properties:
build:
type: object
additionalProperties: false
properties:
extra_docker_build_args:
type: object
additionalProperties: true
default: {}
description: >
Key-value pairs to use as build args during the docker build step of build and release workflow
reviewdog:
type: object
description: Reviewdog configuration. Used during repo-ansible/reviewdog container execution
Expand Down
4 changes: 4 additions & 0 deletions tasks/other-dev-generated-files.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
set_fact:
followup_workflows: "{{ extension_workflows.stdout | from_json }}"

- name: define docker build args
set_fact:
docker_build_args: "{{ default_docker_build_args | combine(repo.github_workflows.build.extra_docker_build_args) }}"

- name: copy github actions workflow files
ansible.builtin.template:
src: "./templates/.github/workflows/{{ item.target }}.j2"
Expand Down
6 changes: 4 additions & 2 deletions templates/.github/workflows/30-release-and-build.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,11 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-to: type=gha
cache-from: type=gha
# For additional docker build args set github_workflows.build.extra_docker_build_args in the repo.yaml file
build-args: |
PACKAGIST_USER=token
PACKAGIST_TOKEN=${{ secrets.PACKAGIST_TOKEN }}
{% for key, value in docker_build_args.items() %}
[[key]]=[[value]]
{% endfor %}
{% if workflow_group in followup_workflows %}
{% for followup_workflow in followup_workflows[workflow_group] %}

Expand Down

0 comments on commit 08c858c

Please sign in to comment.