Skip to content

Commit

Permalink
enable s390x caching
Browse files Browse the repository at this point in the history
  • Loading branch information
robbycochran committed Sep 13, 2024
1 parent a414bb1 commit d12f47b
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/collector-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
- name: Set up builder ccache
uses: actions/cache@v3
with:
path: builder-ccache
path: {{ github.workspace }}/builder/.ccache
key: builder-ccache-${{ matrix.arch }}-${{ github.head_ref || github.ref_name }}-${{ github.sha }}
restore-keys: |
builder-ccache-${{ matrix.arch }}-
Expand Down Expand Up @@ -172,6 +172,7 @@ jobs:
-i ansible/ci \
-e build_hosts='job_id_${{ env.JOB_ID }}' \
-e arch='${{ matrix.arch }}' \
-e github_workspace='${{ github.workspace }}' \
-e @'${{ github.workspace }}/ansible/secrets.yml' \
ansible/ci-build-builder.yml
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/collector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ jobs:
vm-type: rhel-${{ matrix.arch }}
job-tag: builder

- name: Set up ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.arch }}

- name: Create Build VMs
run: |
make -C "${{ github.workspace }}/ansible" create-build-vms
Expand Down Expand Up @@ -157,6 +162,7 @@ jobs:
-i ansible/ci \
-e arch='${{ matrix.arch }}' \
-e build_hosts='job_id_${{ env.JOB_ID }}' \
-e github_workspace='${{ github.workspace }}' \
-e @'${{ github.workspace }}/ansible/secrets.yml' \
ansible/ci-build-collector.yml
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.idea/
.rox/
.ccache/
builder/.ccache/

integration-tests/container-logs/
integration-tests/*.log
Expand Down
18 changes: 18 additions & 0 deletions ansible/ci-build-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
vars:
collector_root: "{{ ansible_env.HOME }}/collector"
local_branch: local
local_ccache_dir: "{{ github_workspace }}/builder/.ccache"
remote_ccache_dir: "{{ collector_root }}/builder/.ccache"

tasks:
- name: Clone repository
Expand All @@ -24,13 +26,29 @@
recursive: true
when: arch == "s390x"

- name: Copy ccache to the remote machine
ansible.builtin.copy:
src: "{{ local_ccache_dir }}"
dest: "{{ remote_ccache_dir }}"
mode: preserve
remote_src: no
delegate_to: localhost
when: arch == "s390x"

- name: Build the collector builder image
community.general.make:
chdir: "{{ ansible_env.GITHUB_WORKSPACE | default(collector_root) }}"
target: builder
params:
USE_CCACHE: "true"

- name: Copy ccache back to local machine
ansible.builtin.fetch:
src: "{{ remote_ccache_dir }}"
dest: "{{ local_ccache_dir }}"
flat: yes
when: arch == "s390x"

- name: Retag collector builder image to arch specific
community.docker.docker_image:
name: "quay.io/stackrox-io/collector-builder:{{ ansible_env.COLLECTOR_BUILDER_TAG }}"
Expand Down
18 changes: 18 additions & 0 deletions ansible/ci-build-collector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
vars:
collector_root: "{{ ansible_env.HOME }}/collector"
local_branch: local
local_ccache_dir: "{{ github_workspace }}/.ccache"
remote_ccache_dir: "{{ collector_root }}/.ccache"

tasks:
- debug: var=collector_root
Expand All @@ -27,6 +29,15 @@
recursive: true
when: arch == "s390x"

- name: Copy ccache to the remote machine
ansible.builtin.copy:
src: "{{ local_ccache_dir }}"
dest: "{{ remote_ccache_dir }}"
mode: preserve
remote_src: no
delegate_to: localhost
when: arch == "s390x"

- name: Run the builder image
community.general.make:
chdir: "{{ ansible_env.GITHUB_WORKSPACE | default(collector_root) }}"
Expand All @@ -43,6 +54,13 @@
# ensure this action is printed
tags: [print_action]

- name: Copy ccache back to local machine
ansible.builtin.fetch:
src: "{{ remote_ccache_dir }}"
dest: "{{ local_ccache_dir }}"
flat: yes
when: arch == "s390x"

- name: Retag collector image to arch specific
community.docker.docker_image:
name: "{{ collector_image }}"
Expand Down

0 comments on commit d12f47b

Please sign in to comment.