Skip to content

Commit cd344fb

Browse files
pablomendezroyoPablo Mendez
andauthored
Use snapshots instead of custom NFS implementation (#8)
* Refactor to integrate SnapshotsAdapter and streamline environment management * allow setting envs instead of flags * implemnet docker * implement time check * use same dappmanager url always * implement github adapter * increase execution time * add todos * fix get servicename utility * add clients versions todos * add todos * fix get servicename * add less verbose todo * implement versions getters for execution and beaconchain adapters * implement version in snapshot * get versions and add them to therpor * remove unused getreport * first implementation of snapshot checker * implement composite adapter in snapshot checker * move logging to snapshot checker service * move all logs from adapters to service test runner * move loggin to test runner * add wait for download in progress * implement wait for download to complete * rename to download adapter * implement testing adapter * improve cleaner execution * improve exit handler testrunner * cleanup flag files adapters * implement file locking * fix log tyypo * relocate blocknumberadapter * add docker dev * set tunonce to true * implement single stop download * implement client overrides * add missin envs to compose dev file * first implementation of CI * implement runonce default to true * remove runonce from ci example * set default log level debug * update CI --------- Co-authored-by: Pablo Mendez <pablo@dappnode.io>
1 parent a915c13 commit cd344fb

45 files changed

Lines changed: 3435 additions & 511 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Release and Publish Docker Images
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Release version (e.g. v1.2.3)'
8+
required: true
9+
type: string
10+
11+
env:
12+
REGISTRY: ghcr.io
13+
IMAGE_PREFIX: ${{ github.repository }}
14+
VERSION: ${{ github.event.inputs.version }}
15+
16+
jobs:
17+
build-binaries:
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
include:
22+
- goos: linux
23+
goarch: amd64
24+
- goos: linux
25+
goarch: arm64
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
30+
- name: Set up Go
31+
uses: actions/setup-go@v5
32+
with:
33+
go-version: '1.24'
34+
35+
- name: Build test-runner
36+
env:
37+
GOOS: ${{ matrix.goos }}
38+
GOARCH: ${{ matrix.goarch }}
39+
CGO_ENABLED: 0
40+
run: |
41+
go build -o test-runner-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/test-runner
42+
43+
- name: Build snapshot-checker
44+
env:
45+
GOOS: ${{ matrix.goos }}
46+
GOARCH: ${{ matrix.goarch }}
47+
CGO_ENABLED: 0
48+
run: |
49+
go build -o snapshot-checker-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/snapshot-checker
50+
51+
- name: Upload artifacts
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: binaries-${{ matrix.goos }}-${{ matrix.goarch }}
55+
path: |
56+
test-runner-${{ matrix.goos }}-${{ matrix.goarch }}
57+
snapshot-checker-${{ matrix.goos }}-${{ matrix.goarch }}
58+
59+
docker:
60+
needs: build-binaries
61+
runs-on: ubuntu-latest
62+
permissions:
63+
contents: read
64+
packages: write
65+
strategy:
66+
matrix:
67+
include:
68+
- name: test-runner
69+
dockerfile: Dockerfile.test-runner
70+
- name: snapshot-checker
71+
dockerfile: Dockerfile.snapshot-checker
72+
steps:
73+
- name: Checkout repository
74+
uses: actions/checkout@v4
75+
76+
- name: Set up Docker Buildx
77+
uses: docker/setup-buildx-action@v3
78+
79+
- name: Log in to Container Registry
80+
uses: docker/login-action@v3
81+
with:
82+
registry: ${{ env.REGISTRY }}
83+
username: ${{ github.actor }}
84+
password: ${{ secrets.GITHUB_TOKEN }}
85+
86+
- name: Build and push Docker image
87+
uses: docker/build-push-action@v5
88+
with:
89+
context: .
90+
file: ${{ matrix.dockerfile }}
91+
push: true
92+
tags: |
93+
${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/${{ matrix.name }}:${{ env.VERSION }}
94+
${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/${{ matrix.name }}:latest
95+
cache-from: type=gha
96+
cache-to: type=gha,mode=max
97+
98+
release:
99+
needs: [build-binaries, docker]
100+
runs-on: ubuntu-latest
101+
steps:
102+
- name: Download all artifacts
103+
uses: actions/download-artifact@v4
104+
with:
105+
path: binaries
106+
merge-multiple: true
107+
108+
- name: Create Release
109+
uses: softprops/action-gh-release@v1
110+
with:
111+
tag_name: ${{ env.VERSION }}
112+
files: binaries/*
113+
generate_release_notes: true

Dockerfile

Lines changed: 0 additions & 41 deletions
This file was deleted.

Dockerfile.snapshot-checker

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Build stage
2+
FROM golang:1.24-alpine AS builder
3+
4+
WORKDIR /app
5+
6+
# Install git for fetching dependencies
7+
RUN apk add --no-cache git
8+
9+
# Copy go mod files first for better caching
10+
COPY go.mod go.sum ./
11+
RUN go mod download
12+
13+
# Copy source code
14+
COPY . .
15+
16+
# Build the snapshot-checker application
17+
RUN CGO_ENABLED=0 GOOS=linux go build -o /app/snapshot-checker ./cmd/snapshot-checker
18+
19+
# Final stage
20+
FROM alpine:latest
21+
22+
WORKDIR /app
23+
24+
# Install ca-certificates for HTTPS requests and docker-cli for snapshot operations
25+
RUN apk add --no-cache ca-certificates docker-cli
26+
27+
# Copy binary from builder
28+
COPY --from=builder /app/snapshot-checker /app/snapshot-checker
29+
30+
ENTRYPOINT ["/app/snapshot-checker"]

Dockerfile.test-runner

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Build stage
2+
FROM golang:1.24-alpine AS builder
3+
4+
WORKDIR /app
5+
6+
# Install git for fetching dependencies
7+
RUN apk add --no-cache git
8+
9+
# Copy go mod files first for better caching
10+
COPY go.mod go.sum ./
11+
RUN go mod download
12+
13+
# Copy source code
14+
COPY . .
15+
16+
# Build the test-runner application
17+
RUN CGO_ENABLED=0 GOOS=linux go build -o /app/test-runner ./cmd/test-runner
18+
19+
# Final stage
20+
FROM alpine:latest
21+
22+
WORKDIR /app
23+
24+
# Install ca-certificates for HTTPS requests and docker-cli for snapshot operations
25+
RUN apk add --no-cache ca-certificates docker-cli
26+
27+
# Copy binary from builder
28+
COPY --from=builder /app/test-runner /app/test-runner
29+
30+
ENTRYPOINT ["/app/test-runner"]

0 commit comments

Comments
 (0)