-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
140 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,6 @@ on: | |
|
||
env: | ||
IMAGE_NAME: stack/gear | ||
BINARY_REPO: maven.pkg.github.com | ||
IMAGE_REPO: ghcr.io | ||
|
||
jobs: | ||
up-to-images: | ||
|
@@ -57,8 +55,7 @@ jobs: | |
${{ env.IMAGE_NAME }}:${{ matrix.env.dev }} | ||
ansible-playbook images.yaml -v | ||
-e devenv=${{ matrix.env.dev }} | ||
-e binary_repo=${{ env.BINARY_REPO }} | ||
-e image_repo=${{ env.IMAGE_REPO }} | ||
-e repo_mode=rw | ||
- uses: mikepenz/[email protected] | ||
if: ${{ !cancelled() && (steps.images.outcome == 'success' || steps.images.outcome == 'failure') }} | ||
with: | ||
|
@@ -108,7 +105,6 @@ jobs: | |
--workdir $(pwd)/baker/ansible | ||
${{ env.IMAGE_NAME }}:${{ matrix.env.dev }} | ||
ansible-playbook stacks.yaml -t build | ||
-e image_repo=${{ env.IMAGE_REPO }} | ||
-e devenv=${{ matrix.env.dev }} | ||
-e purpose=${{ matrix.purpose }} | ||
-e opsenv=${{ matrix.env.ops }} | ||
|
@@ -149,7 +145,7 @@ jobs: | |
with: | ||
name: product-${{ matrix.purpose }}-${{ matrix.env.ops }} | ||
path: stack/product/target/image-context | ||
- name: Run ansible-playbook stacks.yaml -t test | ||
- name: Run ansible-playbook stacks.yaml -t check | ||
run: >- | ||
docker run --rm | ||
--network gear | ||
|
@@ -158,8 +154,7 @@ jobs: | |
--volume /var/run/docker.sock:/var/run/docker.sock | ||
--workdir $(pwd)/baker/ansible | ||
${{ env.IMAGE_NAME }}:${{ matrix.env.dev }} | ||
ansible-playbook stacks.yaml -t test | ||
-e image_repo=${{ env.IMAGE_REPO }} | ||
ansible-playbook stacks.yaml -t check | ||
-e devenv=${{ matrix.env.dev }} | ||
-e purpose=${{ matrix.purpose }} | ||
-e opsenv=${{ matrix.env.ops }} | ||
|
@@ -204,19 +199,19 @@ jobs: | |
with: | ||
name: product-${{ matrix.purpose }}-${{ matrix.env.ops }} | ||
path: stack/product/target/image-context | ||
- name: Run ansible-playbook stacks.yaml -t package | ||
- name: Run ansible-playbook stacks.yaml -t publish | ||
run: >- | ||
docker run --rm | ||
--volume $(pwd):$(pwd) | ||
--volume /var/run/docker.sock:/var/run/docker.sock | ||
--volume ~/.docker/config.json:/root/.docker/config.json:ro | ||
--workdir $(pwd)/baker/ansible | ||
${{ env.IMAGE_NAME }}:${{ matrix.env.dev }} | ||
ansible-playbook stacks.yaml -t package -v | ||
-e image_repo=${{ env.IMAGE_REPO }} | ||
ansible-playbook stacks.yaml -t publish -v | ||
-e devenv=${{ matrix.env.dev }} | ||
-e purpose=${{ matrix.purpose }} | ||
-e opsenv=${{ matrix.env.ops }} | ||
-e repo_mode=rw | ||
stack-reporting: | ||
name: Stack reporting | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,8 +53,7 @@ jobs: | |
${{ env.IMAGE_NAME }}:${{ matrix.env.dev }} | ||
ansible-playbook images.yaml -v | ||
-e devenv=${{ matrix.env.dev }} | ||
-e binary_repo=maven.pkg.github.com | ||
-e image_repo=ghcr.io | ||
-e repo_mode=rw | ||
- uses: mikepenz/[email protected] | ||
if: ${{ !cancelled() && (steps.images.outcome == 'success' || steps.images.outcome == 'failure') }} | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
- name: Binaries | ||
- name: Building & Checking | ||
hosts: app | ||
run_once: true | ||
tasks: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
--- | ||
image_tag: latest | ||
image_context: . | ||
image_push: false | ||
image_args: {} |
9 changes: 5 additions & 4 deletions
9
baker/ansible/roles/image/tasks/main.yaml → baker/ansible/roles/image/tasks/build.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
--- | ||
- name: Enforce variables | ||
- name: Check inputs | ||
ansible.builtin.assert: | ||
quiet: true | ||
that: | ||
- image_name is defined | ||
- image_home is defined | ||
- image_key is defined | ||
- image_tag is defined | ||
|
||
- name: Build image | ||
ansible.builtin.command: | ||
cmd: >- | ||
docker build {{ image_context }} | ||
--file {{ image_home }}/Dockerfile | ||
--file Dockerfile | ||
--label image.key={{ image_key }} | ||
--tag {{ image_name }}:{{ image_tag }} | ||
--tag {{ image_tag }} | ||
{% for key, value in image_args.items() %} | ||
--build-arg {{ key }}={{ value }} | ||
{% endfor %} | ||
strip_empty_ends: false | ||
chdir: "{{ image_home }}" | ||
changed_when: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
- name: Enforce variables | ||
- name: Check inputs | ||
ansible.builtin.assert: | ||
quiet: true | ||
that: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
- name: Check inputs | ||
ansible.builtin.assert: | ||
quiet: true | ||
that: | ||
- source_tag is defined | ||
- target_tags is defined | ||
|
||
- name: Tag images | ||
ansible.builtin.command: | ||
cmd: docker tag {{ source_tag }} {{ item }} | ||
strip_empty_ends: false | ||
loop: "{{ target_tags }}" | ||
|
||
- name: Push images | ||
ansible.builtin.command: | ||
cmd: docker push {{ item }} | ||
strip_empty_ends: false | ||
loop: "{{ target_tags }}" | ||
tags: [push, never] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,12 @@ | ||
--- | ||
- name: Tag images | ||
ansible.builtin.command: | ||
cmd: >- | ||
docker tag | ||
{{ app.image }}:{{ devenv }} | ||
{{ image_ns }}/{{ app.image }}:{{ image_tags[app.binary] }} | ||
strip_empty_ends: false | ||
loop: "{{ image_status.results|select('changed')|map(attribute='app') }}" | ||
- ansible.builtin.include_role: # noqa: name[missing] | ||
name: image | ||
tasks_from: publish | ||
vars: | ||
source_tag: "{{ app.image }}:{{ devenv }}" | ||
target_tags: | ||
- "{{ image_ns }}/{{ app.image }}:{{ hostvars.app.image_tags[app.binary] }}" | ||
loop: "{{ hostvars.app.image_status.results|select('changed')|map(attribute='app') }}" | ||
loop_control: | ||
loop_var: app | ||
label: "{{ app.image }}" | ||
|
||
- name: Push images | ||
ansible.builtin.command: | ||
cmd: docker push {{ image_ns }}/{{ app.image }}:{{ image_tags[app.binary] }} | ||
strip_empty_ends: false | ||
loop: "{{ image_status.results|select('changed')|map(attribute='app') }}" | ||
loop_control: | ||
loop_var: app | ||
label: "{{ app.image }}" | ||
tags: [push, never] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
--- | ||
- name: Build images | ||
ansible.builtin.include_role: | ||
- ansible.builtin.include_role: # noqa: name[missing] | ||
name: image | ||
tasks_from: build | ||
vars: | ||
image_home: "{{ project.dir }}/{{ db.image }}" | ||
image_name: "{{ db.image }}" | ||
image_key: "{{ db.image }}/{{ devenv }}" | ||
image_tag: "{{ devenv }}" | ||
loop: "{{ image_status.results|select('changed')|map(attribute='db') }}" | ||
image_tag: "{{ db.image }}:{{ devenv }}" | ||
loop: "{{ hostvars.db.image_status.results|select('changed')|map(attribute='db') }}" | ||
loop_control: | ||
loop_var: db | ||
label: "{{ db.image }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.