Skip to content

Commit

Permalink
{Earthfile, Jenkinsfile}: Earthly ci testing
Browse files Browse the repository at this point in the history
Change-Id: Ideb2d90c6bb4eb1d6852826655806a4efbe2c47b
  • Loading branch information
dlamarmorgan committed Oct 12, 2023
1 parent f57c59b commit d5e4260
Show file tree
Hide file tree
Showing 26 changed files with 672 additions and 278 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Setup Earthly
run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.6.23/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'"
run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.7.20/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'"
- name: Test
run: earthly --ci +test
- name: Lint
run: earthly --ci +lint
- name: Integration
run: earthly -P --ci +integration
run: earthly -P --ci +integration-all

90 changes: 70 additions & 20 deletions Earthfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
VERSION 0.6
VERSION 0.7
FROM golang:1.19
WORKDIR /go/storj-up

lint:
WORKDIR /go/storj-up
lint-deps:
RUN go install github.com/storj/ci/...@5286f52
RUN go install honnef.co/go/tools/cmd/[email protected]
RUN go install github.com/golangci/golangci-lint/cmd/[email protected]

lint:
FROM +lint-deps
COPY . /go/storj-up
RUN staticcheck ./...
RUN golangci-lint --build-tags mage -j=2 run
Expand All @@ -18,7 +20,19 @@ lint:
RUN check-monkit ./...
RUN check-mod-tidy

build:
build-app-deps:
# Download deps before copying code.
COPY go.mod go.sum ./pkg/config/gen/go.mod ./pkg/config/gen/go.sum .
RUN go mod download
# Output these back in case go mod download changes them.
SAVE ARTIFACT go.mod AS LOCAL go.mod
SAVE ARTIFACT go.sum AS LOCAL go.sum
SAVE ARTIFACT ./pkg/config/gen/go.mod AS LOCAL ./pkg/config/gen/go.mod
SAVE ARTIFACT ./pkg/config/gen/go.sum AS LOCAL ./pkg/config/gen/go.sum

build-app:
FROM +build-app-deps
# Copy and build code.
COPY . .
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
Expand All @@ -40,22 +54,58 @@ test:
./scripts/test.sh
SAVE ARTIFACT build/tests.json AS LOCAL build/tests.json

integration:
FROM earthly/dind:ubuntu
RUN apt-get update && apt-get install -y golang-go docker-compose-plugin gcc
ENV PATH=$PATH:/root/go/bin
COPY . .
WORKDIR /test
WITH DOCKER --pull img.dev.storj.io/storjup/storj:1.83.2 \
--pull img.dev.storj.io/storjup/edge:1.58.1 \
--pull cockroachdb/cockroach \
--pull redis:6.0.9 \
--pull img.dev.storj.io/storjup/storjscan:1.0.3 \
--pull ethereum/client-go
RUN ./test.sh && \
./test-edge.sh && \
./test-storjscan.sh
END
integration-all:
BUILD +integration-uplink
BUILD +integration-edge
BUILD +integration-storjscan

integration-uplink:
FROM earthly/dind:ubuntu
WORKDIR /go/storj-up
COPY +build-app/storj-up .
RUN /go/storj-up/storj-up init minimal,db,uplink
COPY ./test/uplink/basic_upload_download.sh basic_upload_download.sh
WITH DOCKER --compose docker-compose.yaml
RUN docker compose exec -T -u 0 uplink bash -c 'storj-up health --host cockroach -d 120' && \
docker compose exec -T -u 0 uplink bash -c 'storj-up credentials -s satellite-api:7777 -c satellite-api:10000 -e >> ~/.bashrc' && \
< basic_upload_download.sh docker compose exec -T -u 0 uplink bash -i
END

integration-edge:
FROM earthly/dind:ubuntu
WORKDIR /go/storj-up
COPY +build-app/storj-up .
RUN /go/storj-up/storj-up init minimal,edge,db,uplink && \
/go/storj-up/storj-up image uplink img.dev.storj.io/storjup/storj:1.89.5 && \
/go/storj-up/storj-up env set authservice STORJ_ENDPOINT=http://gateway-mt:9999
COPY ./test/edge/basic_rclone.sh basic_rclone.sh
WITH DOCKER --compose docker-compose.yaml
RUN docker compose exec -T -u 0 uplink bash -c 'storj-up health --host cockroach -d 120' && \
docker compose exec -T -u 0 uplink bash -c 'storj-up credentials -s satellite-api:7777 -c satellite-api:10000 -a http://authservice:8888 -e --s3 >> ~/.bashrc' && \
< basic_rclone.sh docker compose exec -T -u 0 uplink bash -i
END

integration-storjscan:
FROM earthly/dind:ubuntu
WORKDIR /go/storj-up
COPY +build-app/storj-up .
RUN /go/storj-up/storj-up init && \
/go/storj-up/storj-up init minimal,satellite-core,edge,db,billing && \
/go/storj-up/storj-up env setenv satellite-core STORJ_PAYMENTS_BILLING_CONFIG_INTERVAL=5s && \
/go/storj-up/storj-up env setenv satellite-core STORJ_PAYMENTS_STORJSCAN_INTERVAL=5s && \
/go/storj-up/storj-up env setenv satellite-core STORJ_PAYMENTS_STORJSCAN_CONFIRMATIONS=12 && \
/go/storj-up/storj-up env setenv storjscan STORJ_TOKEN_PRICE_USE_TEST_PRICES=true && \
/go/storj-up/storj-up image storjscan img.dev.storj.io/storjup/storjscan:20231012
COPY ./test/storjscan/basic_storjscan.sh basic_storjscan.sh
WITH DOCKER --compose docker-compose.yaml
RUN docker compose exec -T -u 0 storjscan bash -c 'storj-up health --host cockroach -d 120' && \
docker compose exec -T -u 0 storjscan bash -c 'storj-up credentials -s satellite-api:7777 -c satellite-api:10000 -a http://authservice:8888 -e >> ~/.bashrc' && \
docker compose cp pk.json storjscan:/var/lib/storj/pk.json && \
docker compose cp pass storjscan:/var/lib/storj/pass && \
docker compose cp TestToken.abi storjscan:/var/lib/storj/TestToken.abi && \
docker compose cp TestToken.bin storjscan:/var/lib/storj/TestToken.bin && \
< basic_storjscan.sh docker compose exec -T -u 0 storjscan bash -i
END

check-format:
COPY . .
Expand Down
55 changes: 39 additions & 16 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pipeline {
agent {
label 'node4'
label('nomad || node4')
}

options {
Expand All @@ -17,20 +17,43 @@ pipeline {
checkout scm
}
}
stage('Lint') {
steps {
sh "earthly +lint"
}
}
stage('Test') {
steps {
sh "earthly +test"
}
}
stage('Integration') {
steps {
sh "earthly -P +integration"
}
}
stage('Lint') {
steps {
sh "earthly +lint"
}
}
stage('Test') {
steps {
sh "earthly +test"
}
}
stage('Integration') {
parallel {
stage('Uplink') {
steps {
withCredentials([usernamePassword(credentialsId: '67d52f80-1802-407a-a21a-ea24d4c28a83', passwordVariable: 'password', usernameVariable: 'username')]) {
sh 'docker login img.dev.storj.io -u $username -p $password'
}
sh "earthly -P +integration-uplink"
}
}
stage('Edge') {
steps {
withCredentials([usernamePassword(credentialsId: '67d52f80-1802-407a-a21a-ea24d4c28a83', passwordVariable: 'password', usernameVariable: 'username')]) {
sh 'docker login img.dev.storj.io -u $username -p $password'
}
sh "earthly -P +integration-edge"
}
}
stage('Storjscan') {
steps {
withCredentials([usernamePassword(credentialsId: '67d52f80-1802-407a-a21a-ea24d4c28a83', passwordVariable: 'password', usernameVariable: 'username')]) {
sh 'docker login img.dev.storj.io -u $username -p $password'
}
sh "earthly -P +integration-storjscan"
}
}
}
}
}
}
43 changes: 21 additions & 22 deletions pkg/config/gen/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ module gen
go 1.19

require (
github.com/stretchr/testify v1.8.2
github.com/stretchr/testify v1.8.4
github.com/zeebo/errs v1.3.0
storj.io/gateway-mt v1.58.1
storj.io/storj v1.83.2
storj.io/gateway-mt v1.62.0
storj.io/storj v1.89.5
storj.io/storj-up v1.0.0
storj.io/storjscan v1.0.3
)
Expand Down Expand Up @@ -62,7 +62,7 @@ require (
github.com/go-ole/go-ole v1.2.4 // indirect
github.com/go-sql-driver/mysql v1.5.0 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt v3.2.1+incompatible // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
Expand Down Expand Up @@ -100,6 +100,7 @@ require (
github.com/jtolds/monkit-hw/v2 v2.0.0-20191108235325-141a0da276b3 // indirect
github.com/jtolds/tracetagger/v2 v2.0.0-rc5 // indirect
github.com/jtolio/eventkit v0.0.0-20230607152326-4668f79ff72d // indirect
github.com/jtolio/mito v0.0.0-20230523171229-d78ef06bb77b // indirect
github.com/jtolio/noiseconn v0.0.0-20230301220541-88105e6c8ac6 // indirect
github.com/klauspost/compress v1.15.15 // indirect
github.com/klauspost/cpuid v1.3.1 // indirect
Expand Down Expand Up @@ -139,8 +140,8 @@ require (
github.com/ncw/directio v1.0.5 // indirect
github.com/nsqio/go-nsq v1.0.8 // indirect
github.com/olivere/elastic/v7 v7.0.22 // indirect
github.com/onsi/ginkgo/v2 v2.2.0 // indirect
github.com/oschwald/maxminddb-golang v1.8.0 // indirect
github.com/onsi/ginkgo/v2 v2.9.5 // indirect
github.com/oschwald/maxminddb-golang v1.12.0 // indirect
github.com/outcaste-io/badger/v3 v3.2202.1-0.20220426173331-b25bc764af0d // indirect
github.com/outcaste-io/ristretto v0.1.1-0.20220420003845-bd658a460d49 // indirect
github.com/philhofer/fwd v1.1.1 // indirect
Expand All @@ -152,10 +153,8 @@ require (
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.39.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/quic-go/qtls-go1-18 v0.2.0 // indirect
github.com/quic-go/qtls-go1-19 v0.2.0 // indirect
github.com/quic-go/qtls-go1-20 v0.1.0 // indirect
github.com/quic-go/quic-go v0.32.0 // indirect
github.com/quic-go/qtls-go1-20 v0.3.2 // indirect
github.com/quic-go/quic-go v0.38.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect
github.com/redis/go-redis/v9 v9.0.3 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
Expand All @@ -167,7 +166,7 @@ require (
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/shirou/gopsutil/v3 v3.21.1 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/spacemonkeygo/monkit/v3 v3.0.20-0.20230419135619-fb89f20752cb // indirect
github.com/spacemonkeygo/monkit/v3 v3.0.22 // indirect
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect
github.com/spacemonkeygo/tlshowdy v0.0.0-20160207005338-8fa2cec1d7cd // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
Expand Down Expand Up @@ -201,16 +200,16 @@ require (
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.23.0 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/exp v0.0.0-20230206171751-46f607a40771 // indirect
golang.org/x/mod v0.8.0 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/oauth2 v0.7.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect
golang.org/x/tools v0.6.0 // indirect
golang.org/x/tools v0.9.1 // indirect
google.golang.org/api v0.118.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
Expand All @@ -226,13 +225,13 @@ require (
gopkg.in/webhelp.v1 v1.0.0-20170530084242-3f30213e4c49 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
storj.io/common v0.0.0-20230719104100-cb5eec2edc30 // indirect
storj.io/common v0.0.0-20230920095429-0ce0a575e6f8 // indirect
storj.io/dotworld v0.0.0-20210324183515-0d11aeccd840 // indirect
storj.io/drpc v0.0.33 // indirect
storj.io/minio v0.0.0-20230627070725-370d887aacde // indirect
storj.io/minio v0.0.0-20230809050351-70d4a6c974ce // indirect
storj.io/monkit-jaeger v0.0.0-20220915074555-d100d7589f41 // indirect
storj.io/picobuf v0.0.1 // indirect
storj.io/private v0.0.0-20230707205547-3f3b667f6ac0 // indirect
storj.io/uplink v1.10.1-0.20230628184638-0e6829c81f5c // indirect
storj.io/picobuf v0.0.2-0.20230906122608-c4ba17033c6c // indirect
storj.io/private v0.0.0-20230912093002-ca2d4ab44679 // indirect
storj.io/uplink v1.12.1 // indirect
storj.io/zipper v0.0.0-20220124122551-2ac2d53a46f6 // indirect
)
Loading

0 comments on commit d5e4260

Please sign in to comment.