Skip to content

Commit c45b3cb

Browse files
committed
label
1 parent 633d07a commit c45b3cb

File tree

10 files changed

+24
-48
lines changed

10 files changed

+24
-48
lines changed

.github/workflows/collector-builder.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ env:
1717
COLLECTOR_TAG: ${{ inputs.collector-tag }}
1818
DEFAULT_BUILDER_TAG: master
1919
ANSIBLE_CONFIG: ${{ github.workspace }}/ansible/ansible.cfg
20+
USE_CCACHE: ${{ !contains(github.event.pull_request.labels.*.name, 'no-ccache') }}
2021

2122
jobs:
2223
builder-needs-rebuilding:
@@ -145,6 +146,7 @@ jobs:
145146
echo "rhacs_eng_password: ${{ secrets.QUAY_RHACS_ENG_RW_PASSWORD }}"
146147
echo "collector_git_ref: ${{ github.ref }}"
147148
echo "collector_builder_tag: ${{ env.COLLECTOR_BUILDER_TAG }}"
149+
echo "use_ccache: ${USE_CCACHE}"
148150
} > ${{ github.workspace }}/ansible/secrets.yml
149151
150152
- name: Build images
@@ -182,14 +184,6 @@ jobs:
182184
run: |
183185
make -C ansible destroy-vms
184186
185-
- name: Store artifacts
186-
if: always()
187-
uses: actions/upload-artifact@v4
188-
with:
189-
name: builder-${{ matrix.arch }}-logs
190-
path: |
191-
${{ github.workspace }}/build_builder_image.log
192-
193187
create-multiarch-manifest:
194188
needs:
195189
- build-builder-image

.github/workflows/collector.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ env:
2626
ANSIBLE_CONFIG: ${{ github.workspace }}/ansible/ansible.cfg
2727
TRACE_SINSP_EVENTS: ${{ github.event_name == 'pull_request' }}
2828
ADDRESS_SANITIZER: ${{ contains(github.event.pull_request.labels.*.name, 'address-sanitizer') }}
29+
USE_CCACHE: ${{ !contains(github.event.pull_request.labels.*.name, 'no-ccache') }}
2930

3031
jobs:
3132
build-collector-image:
@@ -72,6 +73,7 @@ jobs:
7273
collector_tag: ${{ inputs.collector-tag }}
7374
debug_mode: ${{ github.event_name == 'pull_request' }}
7475
driver_version: ${DRIVER_VERSION}
76+
use_ccache: ${USE_CCACHE}
7577
EOF
7678
7779
- name: Build images
@@ -156,6 +158,7 @@ jobs:
156158
collector_image: ${{ inputs.collector-image }}
157159
collector_tag: ${{ inputs.collector-tag }}
158160
debug_mode: ${{ github.event_name == 'pull_request' }}
161+
use_ccache: ${USE_CCACHE}
159162
EOF
160163
161164
- name: Build ${{ matrix.arch }} image

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ ifneq ($(BUILD_BUILDER_IMAGE), false)
3030
--build-arg USE_CCACHE="${USE_CCACHE}" \
3131
-t quay.io/stackrox-io/collector-builder:$(COLLECTOR_BUILDER_TAG) \
3232
-f "$(CURDIR)/builder/Dockerfile" \
33-
"$(CURDIR)/builder" \
34-
2>&1 | tee build_builder_image.log
33+
"$(CURDIR)/builder"
3534
endif
3635

3736
collector: check-builder

Makefile-constants.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ HOST_ARCH := $(shell uname -m | sed -e 's/x86_64/amd64/' -e 's/aarch64/arm64/')
1010
PLATFORM ?= "linux/$(HOST_ARCH)"
1111

1212
USE_VALGRIND ?= false
13+
USE_CCACHE ?= false
1314
ADDRESS_SANITIZER ?= false
1415
CMAKE_BUILD_TYPE ?= Release
1516
CMAKE_BASE_DIR = cmake-build-$(shell echo $(CMAKE_BUILD_TYPE) | tr A-Z a-z)-$(HOST_ARCH)
@@ -19,4 +20,3 @@ BPF_DEBUG_MODE ?= false
1920

2021
COLLECTOR_BUILD_CONTEXT = collector/
2122
COLLECTOR_BUILDER_NAME ?= collector_builder_$(HOST_ARCH)
22-
USE_CCACHE ?= true

ansible/ci-build-builder.yml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
BUILD_BUILDER_IMAGE: "true"
77
COLLECTOR_BUILDER_TAG: "{{ collector_builder_tag }}"
88
PLATFORM: "linux/{{ arch }}"
9+
USE_CCACHE: "{{ use_ccache }}"
910

1011
vars:
1112
collector_root: "{{ ansible_env.HOME }}/collector"
@@ -41,46 +42,37 @@
4142
ansible.builtin.stat:
4243
path: "{{ github_workspace }}/{{ ccache_path }}"
4344
register: ccache_check
44-
when: arch == "s390x"
45+
when: use_ccache and arch == "s390x"
4546

4647
- name: Copy ccache
4748
ansible.builtin.copy:
4849
src: "{{ github_workspace }}/{{ ccache_path }}"
4950
dest: "{{ collector_root }}/{{ ccache_dir }}/"
50-
when: arch == "s390x" and ccache_check.stat.exists
51+
when: use_ccache and arch == "s390x" and ccache_check.stat.exists
5152

5253
- name: Inject docker cache with ccache
5354
ansible.builtin.shell:
5455
cmd: ansible/scripts/inject_docker_cache.sh "{{ collector_root }}/{{ ccache_dir }}" "{{ container_ccache_dir }}"
5556
chdir: "{{ collector_root }}"
56-
when: arch == "s390x" and ccache_check.stat.exists
57+
when: use_ccache and arch == "s390x" and ccache_check.stat.exists
5758

5859
- name: Build the collector builder image
5960
community.general.make:
6061
chdir: "{{ ansible_env.GITHUB_WORKSPACE | default(collector_root) }}"
6162
target: builder
62-
params:
63-
USE_CCACHE: "true"
6463

6564
- name: Extract ccache from docker cache
6665
ansible.builtin.shell:
6766
cmd: ansible/scripts/extract_docker_cache.sh "{{ collector_root }}/{{ ccache_dir }}" "{{ container_ccache_dir }}"
6867
chdir: "{{ collector_root }}"
69-
when: arch == "s390x"
68+
when: use_ccache and arch == "s390x"
7069

7170
- name: Fetch ccache
7271
ansible.builtin.fetch:
7372
src: "{{ collector_root }}/{{ ccache_path }}"
7473
dest: "{{ github_workspace }}/{{ ccache_dir }}/"
7574
flat: yes
76-
when: arch == "s390x"
77-
78-
- name: Fetch build log
79-
ansible.builtin.fetch:
80-
src: "{{ collector_root }}/build_builder_image.log"
81-
dest: "{{ github_workspace }}/"
82-
flat: yes
83-
when: arch == "s390x"
75+
when: use_ccache and arch == "s390x"
8476

8577
- name: Retag collector builder image to arch specific
8678
community.docker.docker_image:

ansible/ci-build-collector.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
COLLECTOR_TAG: "{{ collector_tag }}"
99
DISABLE_PROFILING: "{{ disable_profiling }}"
1010
CMAKE_BUILD_TYPE: "{{ 'Debug' if debug_mode else 'Release' }}"
11+
USE_CCACHE: "{{ use_ccache }}"
12+
CCACHE_DIR: "{{ ansible_env.GITHUB_WORKSPACE | default(collector_root) }}/.ccache"
1113

1214
vars:
1315
collector_root: "{{ ansible_env.HOME }}/collector"
@@ -42,26 +44,26 @@
4244
ansible.builtin.stat:
4345
path: "{{ github_workspace }}/{{ ccache_dir }}/{{ ccache_archive }}"
4446
register: ccache_check
45-
when: arch == "s390x"
47+
when: use_ccache and arch == "s390x"
4648

4749
- name: Create cccache directory
4850
ansible.builtin.file:
4951
path: "{{ collector_root }}/{{ ccache_dir }}"
5052
state: directory
51-
when: arch == "s390x" and ccache_check.stat.exists
53+
when: use_ccache and arch == "s390x" and ccache_check.stat.exists
5254

5355
- name: Copy ccache
5456
ansible.builtin.copy:
5557
src: "{{ github_workspace }}/{{ ccache_dir }}/{{ ccache_archive }}"
5658
dest: "{{ collector_root }}/"
57-
when: arch == "s390x" and ccache_check.stat.exists
59+
when: use_ccache and arch == "s390x" and ccache_check.stat.exists
5860

5961
- name: Unarchive ccache
6062
ansible.builtin.unarchive:
6163
src: "{{ collector_root }}/{{ ccache_archive }}"
6264
dest: "{{ collector_root }}/{{ ccache_dir }}"
6365
remote_src: true
64-
when: arch == "s390x" and ccache_check.stat.exists
66+
when: use_ccache and arch == "s390x" and ccache_check.stat.exists
6567

6668
- name: Run the builder image
6769
community.general.make:
@@ -72,9 +74,6 @@
7274
community.general.make:
7375
chdir: "{{ ansible_env.GITHUB_WORKSPACE | default(collector_root) }}"
7476
target: image
75-
params:
76-
CCACHE_DIR: "{{ ansible_env.GITHUB_WORKSPACE | default(collector_root) }}/.ccache"
77-
USE_CCACHE: true
7877
register: build_result
7978
# ensure this action is printed
8079
tags: [print_action]
@@ -84,14 +83,14 @@
8483
rm -f "{{ collector_root }}/{{ ccache_archive }}"
8584
cd "{{ collector_root }}/{{ ccache_dir }}"
8685
tar czf "{{ collector_root }}/{{ ccache_archive }}" .
87-
when: arch == "s390x"
86+
when: use_ccache and arch == "s390x"
8887

8988
- name: Fetch ccache
9089
ansible.builtin.fetch:
9190
src: "{{ collector_root }}/{{ ccache_archive }}"
9291
dest: "{{ github_workspace }}/{{ ccache_dir }}/"
9392
flat: yes
94-
when: arch == "s390x"
93+
when: use_ccache and arch == "s390x"
9594

9695
- name: Retag collector image to arch specific
9796
community.docker.docker_image:

builder/Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
FROM quay.io/centos/centos:stream9
22

33
ARG BUILD_DIR=/install-tmp
4-
ARG USE_CCACHE=true
4+
ARG USE_CCACHE=false
55
ENV USE_CCACHE=${USE_CCACHE}
66

77
USER root
88

9-
RUN echo $USE_CCACHE
10-
119
RUN dnf -y update \
1210
&& dnf -y install --nobest \
1311
autoconf \

builder/install/ccache.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@ if [ "$USE_CCACHE" = "true" ]; then
1010

1111
cd third_party/ccache
1212
git fetch --tags
13-
git checkout "$(git describe --tags "$(git rev-list --tags --max-count=1)")"
13+
git checkout "${CCACHE_VERSION}"
1414

1515
mkdir cmake-build && cd cmake-build
1616
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTING=OFF -DENABLE_DOCUMENTATION=OFF -DREDIS_STORAGE_BACKEND=OFF ..
1717

1818
make -j "${NPROCS}"
1919
make install
20-
2120
ccache --version
22-
ccache -s
2321
fi

builder/install/install-dependencies.sh

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ if [ "${USE_CCACHE}" = "true" ]; then
2424

2525
# print stats and zero them
2626
ccache -z -d /root/.ccache
27-
28-
#export CCACHE_NOINODECACHE=true
29-
#export CCACHE_SLOPPINESS=time_macros,file_macro,include_file_mtime,include_file_ctime,gcno_cwd
30-
#export CCACHE_DEBUG=1
31-
#export CCACHE_DEBUGDIR=/ccache-debug
32-
#export CCACHE_LOGFILE=/ccache.log
33-
#mkdir "${CCACHE_DEBUGDIR}" || true
3427
fi
3528

3629
# shellcheck source=SCRIPTDIR/versions.sh
@@ -42,6 +35,5 @@ for f in builder/install/[0-9][0-9]-*.sh; do
4235
done
4336

4437
if [ "${USE_CCACHE}" = "true" ]; then
45-
echo "=== ccache stats after build ==="
4638
ccache -s -d /root/.ccache
4739
fi

builder/install/versions.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
export B64_VERSION=1.2.1
44
export CARES_VERSION=1.16.0
5+
export CCACHE_VERSION=v4.10.2
56
export CMAKE_VERSION=3.15.2
67
export GOOGLETEST_REVISION=release-1.10.0
78
export GRPC_REVISION=v1.28.1

0 commit comments

Comments
 (0)