Skip to content

Commit

Permalink
feat: add reproducibility pipelines
Browse files Browse the repository at this point in the history
This helps automate the reproducibility test.

Signed-off-by: Noel Georgi <[email protected]>
  • Loading branch information
frezbo committed May 19, 2023
1 parent c6a41b6 commit 2e46e5b
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 16 deletions.
55 changes: 53 additions & 2 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
kind: pipeline
name: default
type: kubernetes
name: default

steps:
- name: setup-ci
Expand All @@ -26,6 +26,8 @@ steps:
path: /root/.docker/buildx

- name: build-pull-request
depends_on:
- setup-ci
image: autonomy/build-container:latest
pull: always
commands:
Expand All @@ -42,7 +44,54 @@ steps:
- name: docker
path: /root/.docker/buildx

- name: reproducibility-test
depends_on:
- setup-ci
image: autonomy/build-container:latest
pull: always
commands:
- make reproducibility-test
when:
target:
include:
- integration-reproducibility
event:
exclude:
- pull_request
- tag
volumes:
- name: docker-socket
path: /var/run
- name: ssh
path: /root/.ssh
- name: docker
path: /root/.docker/buildx

- name: reproducibility-test-cron
depends_on:
- setup-ci
image: autonomy/build-container:latest
pull: always
commands:
- make reproducibility-test
when:
cron:
- weekly
event:
exclude:
- pull_request
- tag
volumes:
- name: docker-socket
path: /var/run
- name: ssh
path: /root/.ssh
- name: docker
path: /root/.docker/buildx

- name: build-and-publish
depends_on:
- setup-ci
image: autonomy/build-container:latest
pull: always
environment:
Expand All @@ -57,6 +106,8 @@ steps:
event:
exclude:
- pull_request
- promote
- cron
volumes:
- name: docker-socket
path: /var/run
Expand All @@ -81,8 +132,8 @@ volumes:
temp: {}
---
kind: pipeline
name: notify
type: kubernetes
name: notify

clone:
disable: true
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
bin/
_out/
_out*
21 changes: 11 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ REGISTRY_AND_USERNAME := $(REGISTRY)/$(USERNAME)
SOURCE_DATE_EPOCH ?= "1559830076"

# Sync bldr image with Pkgfile
BLDR_IMAGE := ghcr.io/siderolabs/bldr:v0.2.0-alpha.12-4-g857d0d8
BLDR_IMAGE := ghcr.io/siderolabs/bldr:v0.2.0
BLDR ?= docker run --rm --volume $(PWD):/tools --entrypoint=/bldr \
$(BLDR_IMAGE) graph --root=/tools

Expand Down Expand Up @@ -42,15 +42,16 @@ target-%: ## Builds the specified target defined in the Pkgfile. The build resul
local-%: ## Builds the specified target defined in the Pkgfile using the local output type. The build result will be output to the specified local destination.
@$(MAKE) target-$* TARGET_ARGS="--output=type=local,dest=$(DEST) $(TARGET_ARGS)"

rebuild-%: ## Builds the specified target twice into $(DEST)/build-1/2 and compares results.
@rm -fr $(DEST)/build-1 $(DEST)/build-2 $(DEST)/build-1.txt $(DEST)/build-2.txt
@$(MAKE) target-$* PROGRESS=plain TARGET_ARGS="--output=type=local,dest=$(DEST)/build-1 $(TARGET_ARGS)" 2>&1 | tee $(DEST)/build-1.txt
@docker buildx rm reproducer || true
@docker buildx create --driver docker-container --driver-opt network=host --name reproducer
@$(MAKE) target-$* PROGRESS=plain TARGET_ARGS="--output=type=local,dest=$(DEST)/build-2 --builder=reproducer $(TARGET_ARGS)" 2>&1 | tee $(DEST)/build-2.txt
@docker buildx rm reproducer
@find _out/ -exec touch -ch -t 202108110000 {} \;
@diffoscope _out/build-1 _out/build-2
reproducibility-test:
@$(MAKE) reproducibility-test-local-tools

reproducibility-test-local-%: ## Builds the specified target defined in the Pkgfile using the local output type. The build result will be output to the specified local destination.
@rm -rf _out1/ _out2/
@$(MAKE) local-$* DEST=_out1
@$(MAKE) local-$* DEST=_out2 TARGET_ARGS="--no-cache"
@touch -ch -t $$(date -d @$(SOURCE_DATE_EPOCH) +%Y%m%d0000) _out1 _out2
@diffoscope _out1 _out2
@rm -rf _out1/ _out2/

docker-%: ## Builds the specified target defined in the Pkgfile using the docker output type. The build result will be loaded into Docker.
@$(MAKE) target-$* TARGET_ARGS="$(TARGET_ARGS)"
Expand Down
4 changes: 2 additions & 2 deletions Pkgfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# syntax = ghcr.io/siderolabs/bldr:v0.2.0-alpha.12-4-g857d0d8
# syntax = ghcr.io/siderolabs/bldr:v0.2.0

# Sync bldr image with Makefile

format: v1alpha2

vars:
TOOLCHAIN_IMAGE: ghcr.io/siderolabs/toolchain:v0.8.0-3-g80a2609
TOOLCHAIN_IMAGE: ghcr.io/siderolabs/toolchain:v0.8.0-4-g38726bd

# renovate: datasource=github-releases depName=abseil/abseil-cpp
abseil_version: 20230125.3
Expand Down

0 comments on commit 2e46e5b

Please sign in to comment.