Skip to content

Commit

Permalink
Migrate the buildAndPublishDocker job from Drone to GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
vascoguita committed Dec 1, 2022
1 parent 878df62 commit ea4abdf
Show file tree
Hide file tree
Showing 23 changed files with 174 additions and 265 deletions.
129 changes: 0 additions & 129 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ def main(ctx):
# implemented for: ocisIntegrationTests and s3ngIntegrationTests
return [
checkStarlark(),
buildAndPublishDocker(),
testIntegration(),
release(),
litmusOcisOldWebdav(),
Expand All @@ -80,133 +79,6 @@ def main(ctx):
virtualViews(),
] + ocisIntegrationTests(6) + s3ngIntegrationTests(12)

def buildAndPublishDocker():
return {
"kind": "pipeline",
"type": "docker",
"name": "build-and-publish-docker",
"platform": {
"os": "linux",
"arch": "amd64",
},
"trigger": {
"branch": [
"master",
],
"event": {
"exclude": [
"pull_request",
"tag",
"promote",
"rollback",
],
},
},
"steps": [
{
"name": "store-dev-release",
"image": "registry.cern.ch/docker.io/library/golang:1.19",
"environment": {
"USERNAME": {
"from_secret": "cbox_username",
},
"PASSWORD": {
"from_secret": "cbox_password",
},
},
"detach": True,
"commands": [
"TZ=Europe/Berlin go run tools/create-artifacts/main.go -dev -commit ${DRONE_COMMIT} -goversion `go version | awk '{print $$3}'`",
"curl --fail -X MKCOL 'https://cernbox.cern.ch/cernbox/desktop/remote.php/webdav/eos/project/r/reva/www/daily/' -k -u $${USERNAME}:$${PASSWORD}",
"curl --fail -X MKCOL 'https://cernbox.cern.ch/cernbox/desktop/remote.php/webdav/eos/project/r/reva/www/daily/'$(date +%Y-%m-%d) -k -u $${USERNAME}:$${PASSWORD}",
"curl --fail -X MKCOL 'https://cernbox.cern.ch/cernbox/desktop/remote.php/webdav/eos/project/r/reva/www/daily/'$(date +%Y-%m-%d)'/${DRONE_COMMIT}' -k -u $${USERNAME}:$${PASSWORD}",
"for i in $(ls /drone/src/dist);do curl --fail -X PUT -u $${USERNAME}:$${PASSWORD} https://cernbox.cern.ch/cernbox/desktop/remote.php/webdav/eos/project/r/reva/www/daily/$(date +%Y-%m-%d)/${DRONE_COMMIT}/$${i} --data-binary @./dist/$${i} ; done",
],
},
makeStep("ci"),
{
"name": "publish-docker-reva-latest",
"pull": "always",
"image": "plugins/docker",
"settings": {
"repo": "cs3org/reva",
"tags": "latest",
"dockerfile": "Dockerfile.reva",
"username": {
"from_secret": "dockerhub_username",
},
"password": {
"from_secret": "dockerhub_password",
},
"custom_dns": [
"128.142.17.5",
"128.142.16.5",
],
},
},
{
"name": "publish-docker-revad-latest",
"pull": "always",
"image": "plugins/docker",
"settings": {
"repo": "cs3org/revad",
"tags": "latest",
"dockerfile": "Dockerfile.revad",
"username": {
"from_secret": "dockerhub_username",
},
"password": {
"from_secret": "dockerhub_password",
},
"custom_dns": [
"128.142.17.5",
"128.142.16.5",
],
},
},
{
"name": "publish-docker-revad-eos-latest",
"pull": "always",
"image": "plugins/docker",
"settings": {
"repo": "cs3org/revad",
"tags": "latest-eos",
"dockerfile": "Dockerfile.revad-eos",
"username": {
"from_secret": "dockerhub_username",
},
"password": {
"from_secret": "dockerhub_password",
},
"custom_dns": [
"128.142.17.5",
"128.142.16.5",
],
},
},
{
"name": "publish-docker-revad-ceph-latest",
"pull": "always",
"image": "plugins/docker",
"settings": {
"repo": "cs3org/revad",
"tags": "latest-ceph",
"dockerfile": "Dockerfile.revad-ceph",
"username": {
"from_secret": "dockerhub_username",
},
"password": {
"from_secret": "dockerhub_password",
},
"custom_dns": [
"128.142.17.5",
"128.142.16.5",
],
},
},
],
}

def testIntegration():
return {
"kind": "pipeline",
Expand Down Expand Up @@ -257,7 +129,6 @@ def release():
},
},
"steps": [
makeStep("ci"),
{
"name": "create-dist",
"image": "registry.cern.ch/docker.io/library/golang:1.19",
Expand Down
27 changes: 0 additions & 27 deletions .github/workflows/build-and-test.yml

This file was deleted.

32 changes: 24 additions & 8 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,42 @@
name: Build Docker
on:
push:
branches:
- "master"
pull_request:
paths-ignore:
- "tools/**"
- "docs/**"
- ".drone.star"
- ".drone.env"
- ".fossa.yml"
workflow_dispatch:

jobs:
docker:
runs-on: self-hosted
strategy:
matrix:
include:
- tag: reva:latest
file: Dockerfile.reva
- tag: revad:latest
file: Dockerfile.revad
- tag: revad:latest-eos
file: Dockerfile.revad-eos
- tag: revad:latest-ceph
file: Dockerfile.revad-ceph
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build
- name: Login to Docker Hub
uses: docker/login-action@v2
if: ${{ github.event_name != 'pull_request' }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build ${{ ((github.event_name != 'pull_request') && 'and push') || '' }} ${{ matrix.tag }}
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile.revad
push: ${{ github.event_name != 'pull_request' }}
file: ${{ matrix.file }}
tags: ${{ ((github.event_name != 'pull_request') && format('{0}/{1}', secrets.DOCKERHUB_USERNAME, matrix.tag)) || '' }}
16 changes: 2 additions & 14 deletions .github/workflows/check-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,5 @@ jobs:
uses: actions/setup-go@v3.3.0
with:
go-version-file: go.mod
- name: Clone calens
uses: actions/checkout@v3
with:
repository: restic/calens
path: calens
fetch-depth: 0
ref: v0.2.0
- name: Install calens
run: cd calens && go install
- name: Check if changelog exists
run: |
$(go env GOPATH)/bin/calens | \
sed -n '/^Changelog for reva unreleased (UNRELEASED)/,/^Details/p' | \
grep -E '^ \* [[:alpha:]]{3} #${{ github.event.pull_request.number }}: '
- name: Check changelog
run: make check-changelog PR=${{ github.event.pull_request.number }}
26 changes: 0 additions & 26 deletions .github/workflows/golangci-lint.yml

This file was deleted.

15 changes: 15 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Lint
on: [pull_request, push, workflow_dispatch]

jobs:
lint:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3.1.0
- name: Setup Go environment
uses: actions/setup-go@v3.3.0
with:
go-version-file: go.mod
- name: Run linters
run: make lint
15 changes: 15 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Test
on: [pull_request, push, workflow_dispatch]

jobs:
test:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go environment
uses: actions/setup-go@v3.3.0
with:
go-version-file: go.mod
- name: Test
run: make test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,5 @@ tmp/

# drone
.drone.yml

toolchain/
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ To compile the REVA daemon and the REVA command line you can:
$ git clone https://github.com/cs3org/reva
$ make
$ ./cmd/revad/revad --version
version=v0.0.0 commit=639f48d branch=review go_version=go1.11.5 build_date=2019-04-17T13:57:17+0200 build_platform=linux/amd64
version=v0.0.0 commit=639f48d branch=review go_version=go1.19 build_date=2019-04-17T13:57:17+0200 build_platform=linux/amd64
```

If you only want to run the tests you can:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.reva
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.

FROM golang:alpine3.13 as builder
FROM golang:alpine3.16 as builder

RUN apk --no-cache add \
ca-certificates \
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.revad
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.

FROM golang:alpine3.13 as builder
FROM golang:alpine3.16 as builder

RUN apk --no-cache add \
ca-certificates \
Expand All @@ -36,7 +36,7 @@ RUN make build-revad-docker && \

RUN mkdir -p /etc/revad/ && echo "" > /etc/revad/revad.toml

FROM golang:alpine3.13
FROM golang:alpine3.16

RUN apk --no-cache add \
mailcap
Expand Down
10 changes: 5 additions & 5 deletions Dockerfile.revad-ceph
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ RUN dnf update -y && dnf install -y \
librbd-devel \
librados-devel

ADD https://golang.org/dl/go1.16.4.linux-amd64.tar.gz \
go1.16.4.linux-amd64.tar.gz
ADD https://golang.org/dl/go1.19.linux-amd64.tar.gz \
go1.19.linux-amd64.tar.gz

RUN rm -rf /usr/local/go && \
tar -C /usr/local -xzf go1.16.4.linux-amd64.tar.gz && \
rm go1.16.4.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.19.linux-amd64.tar.gz && \
rm go1.19.linux-amd64.tar.gz

ENV PATH /go/bin:/usr/local/go/bin:$PATH
ENV GOPATH /go

WORKDIR /go/src/github/cs3org/reva
COPY . .
RUN mkdir -p /go/bin \
RUN mkdir -p /go/bin && \
make build-revad-cephfs-docker && \
cp /go/src/github/cs3org/reva/cmd/revad/revad /usr/bin/revad

Expand Down
Loading

0 comments on commit ea4abdf

Please sign in to comment.