From ee7ad9f3830097d6bd85f7fa616436cad510e22b Mon Sep 17 00:00:00 2001 From: felixboehm Date: Wed, 7 Oct 2020 15:57:09 +0200 Subject: [PATCH 1/6] add eos-ocis docker images --- ocis/docker/eos-ocis-dev/Dockerfile | 24 ++++++++ ocis/docker/eos-ocis-dev/README.md | 90 +++++++++++++++++++++++++++++ ocis/docker/eos-ocis-dev/entrypoint | 4 ++ ocis/docker/eos-ocis-dev/start-ldap | 14 +++++ ocis/docker/eos-ocis/Dockerfile | 37 ++++++++++++ ocis/docker/eos-ocis/README.md | 32 ++++++++++ ocis/docker/eos-ocis/entrypoint | 41 +++++++++++++ ocis/docker/eos-ocis/setup | 23 ++++++++ ocis/docker/eos-ocis/user.go | 13 +++++ 9 files changed, 278 insertions(+) create mode 100644 ocis/docker/eos-ocis-dev/Dockerfile create mode 100644 ocis/docker/eos-ocis-dev/README.md create mode 100755 ocis/docker/eos-ocis-dev/entrypoint create mode 100755 ocis/docker/eos-ocis-dev/start-ldap create mode 100644 ocis/docker/eos-ocis/Dockerfile create mode 100644 ocis/docker/eos-ocis/README.md create mode 100755 ocis/docker/eos-ocis/entrypoint create mode 100755 ocis/docker/eos-ocis/setup create mode 100644 ocis/docker/eos-ocis/user.go diff --git a/ocis/docker/eos-ocis-dev/Dockerfile b/ocis/docker/eos-ocis-dev/Dockerfile new file mode 100644 index 000000000..01163fc2a --- /dev/null +++ b/ocis/docker/eos-ocis-dev/Dockerfile @@ -0,0 +1,24 @@ +FROM owncloud/eos-base:4.6.5 + +ENV CGO_ENABLED=1 +ENV GOOS=linux + +RUN rpm --rebuilddb && yum -y install \ + wget \ + time \ + make \ + gcc \ + git + +RUN wget -q https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz +RUN mkdir -p /usr/local/bin +RUN tar xf go1.14.2.linux-amd64.tar.gz -C /usr/local +RUN ln -s /usr/local/go/bin/* /usr/local/bin + +COPY entrypoint /entrypoint +COPY start-ldap /start-ldap + +VOLUME [ "/ocis" ] +WORKDIR /ocis + + diff --git a/ocis/docker/eos-ocis-dev/README.md b/ocis/docker/eos-ocis-dev/README.md new file mode 100644 index 000000000..69bc68830 --- /dev/null +++ b/ocis/docker/eos-ocis-dev/README.md @@ -0,0 +1,90 @@ +# Docker image for ocis development with eos + +Image is based on [owncloud/eos-base](https://hub.docker.com/r/owncloud/eos-base) from [eos-stack](https://github.com/owncloud-docker/eos-stack) + +## Build +``` +docker build -t owncloud/eos-ocis-dev:latest . +``` + +## Publish +``` +docker push owncloud/eos-ocis-dev:latest +``` + +## Maintainer + +- [Felix Böhm](https://github.com/felixboehm) + +## Disclaimer +Use only for development or testing. Setup is not secured nor tested. + +# oCIS development on eos + +## Setup oCIS + +To build and run your local ocis code with default storage driver + +``` +docker run --rm -ti --name ocis -v $PWD:/ocis -p 9200:9200 owncloud/eos-ocis-dev +``` + +ocis will use the owncloud storage driver and store files in the container at /var/tmp/reva/data//files + +Data is here: `docker exec -it ocis ll /var/tmp/reva/` + +Alternative: With the [docker-compose.yml file in ocis repo](https://github.com/owncloud/ocis/blob/master/docker-compose.yml) you can also start ocis via compose: + +``` +docker-compose up -d ocis +``` + +Now try to list the running services + +``` +docker-compose exec ocis ./bin/ocis list +``` + +## Setup eos storage + +1. Start the eos cluster and ocis via the compose stack + +``` +docker-compose up -d +``` + +2. Start the ldap authentication + +``` +docker-compose exec -d ocis /start-ldap +``` + +3. Configure to use eos storage driver instead of default storage driver + +- kill the home storage and data providers. we need to switch them to the eoshome driver: + +``` +docker-compose exec ocis ./bin/ocis kill reva-storage-home +docker-compose exec ocis ./bin/ocis kill reva-storage-home-data +``` + +- restart them with the eoshome driver and a new layout: + +``` +docker-compose exec -e REVA_STORAGE_EOS_LAYOUT="{{substr 0 1 .Username}}/{{.Username}}" -e REVA_STORAGE_HOME_DRIVER=eoshome -d ocis ./bin/ocis run reva-storage-home +docker-compose exec -e REVA_STORAGE_EOS_LAYOUT="{{substr 0 1 .Username}}/{{.Username}}" -e REVA_STORAGE_HOME_DATA_DRIVER=eoshome -d ocis ./bin/ocis run reva-storage-home-data +``` + +- restart the reva frontend with a new namespace (pointing to the eos storage provider) for the dav files endpoint + +``` +docker-compose exec ocis ./bin/ocis kill reva-frontend +docker-compose exec -e DAV_FILES_NAMESPACE="/eos/" -d ocis ./bin/ocis run reva-frontend +``` + +- login with `einstein / relativity`, upload a file to einsteins home and verify the file is there using + +``` +docker-compose exec ocis eos ls -l /eos/dockertest/reva/users/e/einstein/ +-rw-r--r-- 1 einstein users 10 Jul 1 15:24 newfile.txt +``` diff --git a/ocis/docker/eos-ocis-dev/entrypoint b/ocis/docker/eos-ocis-dev/entrypoint new file mode 100755 index 000000000..88e02157b --- /dev/null +++ b/ocis/docker/eos-ocis-dev/entrypoint @@ -0,0 +1,4 @@ +#!/bin/sh + +make build +exec bin/ocis server \ No newline at end of file diff --git a/ocis/docker/eos-ocis-dev/start-ldap b/ocis/docker/eos-ocis-dev/start-ldap new file mode 100755 index 000000000..6d8d30768 --- /dev/null +++ b/ocis/docker/eos-ocis-dev/start-ldap @@ -0,0 +1,14 @@ +#!/bin/sh + +echo "Waiting for EOS MGM" +echo "until nc -z -w 3 $EOS_MGM_ALIAS 1094; do sleep 2; done;" > /wait-for-mgm +chmod +x /wait-for-mgm + +/wait-for-mgm; +echo "----- [ocis] LDAP setup -----"; +authconfig --enableldap --enableldapauth --ldapserver=${EOS_LDAP_HOST} --ldapbasedn="dc=example,dc=org" --update; +sed -i "s/#binddn cn=.*/binddn ${LDAP_BINDDN}/" /etc/nslcd.conf +sed -i "s/#bindpw .*/bindpw ${LDAP_BINDPW}/" /etc/nslcd.conf +# start in debug mode; + +nslcd -d diff --git a/ocis/docker/eos-ocis/Dockerfile b/ocis/docker/eos-ocis/Dockerfile new file mode 100644 index 000000000..ca0b431b1 --- /dev/null +++ b/ocis/docker/eos-ocis/Dockerfile @@ -0,0 +1,37 @@ +FROM centos:7 as build +ARG BRANCH=master + +ENV CGO_ENABLED=1 +ENV GOOS=linux +RUN rpm --rebuilddb && yum -y install \ + wget \ + time \ + make \ + gcc \ + git +RUN wget -q https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz +RUN mkdir -p /usr/local/bin +RUN tar xf go1.14.2.linux-amd64.tar.gz -C /usr/local +RUN ln -s /usr/local/go/bin/* /usr/local/bin +RUN git clone https://github.com/owncloud/ocis.git +RUN cd ocis && git checkout ${BRANCH} +RUN cd ocis && git log -n 1 +RUN cd ocis && go build -v -o bin/ocis -toolexec '/usr/bin/time -v' ./cmd/ocis +# RUN cd ocis && make generate bin/ocis + +# build user lookup test program +RUN mkdir -p /build +ADD user.go /build/user.go +RUN cd /build && go build -o user user.go + + +FROM owncloud/eos-base:4.6.5 +RUN mkdir -p /usr/local/bin +COPY --from=build ocis/bin/ocis /usr/local/bin/ +RUN chmod +x /usr/local/bin/ocis + +COPY --from=build /build/user /usr/local/bin/user +RUN chmod +x /usr/local/bin/user + +COPY setup /setup +COPY entrypoint /entrypoint diff --git a/ocis/docker/eos-ocis/README.md b/ocis/docker/eos-ocis/README.md new file mode 100644 index 000000000..17a669080 --- /dev/null +++ b/ocis/docker/eos-ocis/README.md @@ -0,0 +1,32 @@ +# Docker image for ocis running on eos + +Image is based on [owncloud/eos-base](https://hub.docker.com/r/owncloud/eos-base) from [eos-stack](https://github.com/owncloud-docker/eos-stack) + +## Build +Build owncloud/ocis master branch +``` +docker build -t owncloud/eos-ocis:latest . +``` + +Or build a certain branch / tag +``` +docker build -t owncloud/eos-ocis:1.0.0 --build-arg BRANCH=v1.0.0./eos-ocis +``` + +## Publish +``` +docker push owncloud/eos-ocis:latest +``` + +## Maintainer + +- [Felix Böhm](https://github.com/felixboehm) + +## Disclaimer +Use only for development or testing. Setup is not secured nor tested. + +## Example Usage + +See https://github.com/owncloud-docker/compose-playground/tree/master/examples/eos-compose + + diff --git a/ocis/docker/eos-ocis/entrypoint b/ocis/docker/eos-ocis/entrypoint new file mode 100755 index 000000000..326b517e2 --- /dev/null +++ b/ocis/docker/eos-ocis/entrypoint @@ -0,0 +1,41 @@ +#!/bin/sh + +# todo: log all ocis services to stdout + +echo "Waiting for EOS MGM" +echo "until nc -z -w 3 $EOS_MGM_ALIAS 1094; do sleep 2; done;" > /wait-for-mgm +chmod +x /wait-for-mgm +mkdir -p /var/log/ocis + +(/wait-for-mgm; /setup > /var/log/ocis/setup.log; cat /var/log/ocis/setup.log ) & + +echo "----- [ocis] DOMAIN setup -----" +echo "Domain / IP: $OCIS_DOMAIN" +mkdir -p /etc/ocis +sed -e "s|@IPADDR@|${OCIS_DOMAIN}|g" /config/identifier-registration.yml.tmpl > /etc/ocis/identifier-registration.yml + +# TODO do we still need to precreate this folder? +mkdir -p /var/tmp/reva + +echo "----- [ocis] Starting oCIS -----" +# todo start ocis as daemon not as root +ocis reva-storage-home & +ocis reva-storage-home-data & +ocis reva-storage-eos & +ocis reva-storage-eos-data & +ocis reva-storage-public-link & +ocis micro & +ocis glauth & +ocis graph-explorer & +ocis graph & +ocis konnectd & +ocis phoenix & +ocis thumbnails & +ocis webdav & +ocis reva-auth-basic & +ocis reva-auth-bearer & +ocis reva-frontend & +ocis reva-gateway & +ocis reva-sharing & +ocis reva-users & +exec ocis proxy diff --git a/ocis/docker/eos-ocis/setup b/ocis/docker/eos-ocis/setup new file mode 100755 index 000000000..b146fbbf4 --- /dev/null +++ b/ocis/docker/eos-ocis/setup @@ -0,0 +1,23 @@ +#!/bin/bash + +set -x + +echo "----- [ocis] LDAP setup -----" +authconfig --enableldap --enableldapauth --ldapserver=${EOS_LDAP_HOST} --ldapbasedn="dc=example,dc=org" --update +sed -i "s/#binddn cn=.*/binddn ${LDAP_BINDDN}/" /etc/nslcd.conf +sed -i "s/#bindpw .*/bindpw ${LDAP_BINDPW}/" /etc/nslcd.conf +# start in debug mode +nslcd -d & + +# echo "----- [ocis] eos setup -----" +# eos -r 0 0 -b vid set membership daemon -uids adm +# eos -r 0 0 -b vid set membership daemon -gids adm +# eos -r 0 0 -b vid set membership daemon +sudo +# eos -r 0 0 -b vid set map -unix "" vuid:0 vgid:0 +# # eos -r 0 0 -b vid add gateway ocis.testnet +# eos -r 0 0 -b vid add gateway ocis + +# todo start ocis as daemon not as root +# eos -r 0 0 -b vid set membership root -uids adm +# eos -r 0 0 -b vid set membership root -gids adm +# eos -r 0 0 -b vid set membership root +sudo diff --git a/ocis/docker/eos-ocis/user.go b/ocis/docker/eos-ocis/user.go new file mode 100644 index 000000000..7b9319004 --- /dev/null +++ b/ocis/docker/eos-ocis/user.go @@ -0,0 +1,13 @@ +package main + +import ( + "fmt" + "os" + gouser "os/user" +) + +func main() { + username := os.Args[1] + user, err := gouser.Lookup(username) + fmt.Printf("User %#v %#v %#v\n", username, user, err) +} From 042411ab10cdda31bfb9a76ce7fbcdaec56c98f5 Mon Sep 17 00:00:00 2001 From: felixboehm Date: Wed, 7 Oct 2020 16:07:31 +0200 Subject: [PATCH 2/6] Start the ldap server from the entrypoint --- ocis/docker/eos-ocis-dev/README.md | 8 +------- ocis/docker/eos-ocis-dev/entrypoint | 2 ++ ocis/docker/eos-ocis-dev/start-ldap | 3 +++ 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ocis/docker/eos-ocis-dev/README.md b/ocis/docker/eos-ocis-dev/README.md index 69bc68830..4e029100b 100644 --- a/ocis/docker/eos-ocis-dev/README.md +++ b/ocis/docker/eos-ocis-dev/README.md @@ -53,13 +53,7 @@ docker-compose exec ocis ./bin/ocis list docker-compose up -d ``` -2. Start the ldap authentication - -``` -docker-compose exec -d ocis /start-ldap -``` - -3. Configure to use eos storage driver instead of default storage driver +2. Configure to use eos storage driver instead of default storage driver - kill the home storage and data providers. we need to switch them to the eoshome driver: diff --git a/ocis/docker/eos-ocis-dev/entrypoint b/ocis/docker/eos-ocis-dev/entrypoint index 88e02157b..35d46f347 100755 --- a/ocis/docker/eos-ocis-dev/entrypoint +++ b/ocis/docker/eos-ocis-dev/entrypoint @@ -1,4 +1,6 @@ #!/bin/sh make build +/start-ldap & + exec bin/ocis server \ No newline at end of file diff --git a/ocis/docker/eos-ocis-dev/start-ldap b/ocis/docker/eos-ocis-dev/start-ldap index 6d8d30768..64a5df0e6 100755 --- a/ocis/docker/eos-ocis-dev/start-ldap +++ b/ocis/docker/eos-ocis-dev/start-ldap @@ -1,5 +1,8 @@ #!/bin/sh +LDAP_BINDDN=${LDAP_BINDDN:-cn=reva,ou=sysusers,dc=example,dc=org} +LDAP_BINDPW=${LDAP_BINDPW:-reva} + echo "Waiting for EOS MGM" echo "until nc -z -w 3 $EOS_MGM_ALIAS 1094; do sleep 2; done;" > /wait-for-mgm chmod +x /wait-for-mgm From ede9bb47b6eac04fd7ebb365f0835f3eef43994e Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Tue, 13 Oct 2020 14:13:33 +0200 Subject: [PATCH 3/6] Fix codacy --- .codacy.yml | 4 +++- ocis/docker/eos-ocis-dev/README.md | 38 +++++++++++++++--------------- ocis/docker/eos-ocis/Dockerfile | 2 +- ocis/docker/eos-ocis/README.md | 16 ++++++------- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/.codacy.yml b/.codacy.yml index 4f5704e63..6bfc61e05 100644 --- a/.codacy.yml +++ b/.codacy.yml @@ -10,5 +10,7 @@ exclude_paths: - 'konnectd/assets/identifier/**' - 'settings/rollup.config.js' - 'accounts/rollup.config.js' + - 'ocis/docker/eos-ocis/Dockerfile' + - 'ocis/docker/eos-ocis-dev/Dockerfile' -... \ No newline at end of file +... diff --git a/ocis/docker/eos-ocis-dev/README.md b/ocis/docker/eos-ocis-dev/README.md index 4e029100b..6f4b3c384 100644 --- a/ocis/docker/eos-ocis-dev/README.md +++ b/ocis/docker/eos-ocis-dev/README.md @@ -3,29 +3,29 @@ Image is based on [owncloud/eos-base](https://hub.docker.com/r/owncloud/eos-base) from [eos-stack](https://github.com/owncloud-docker/eos-stack) ## Build -``` +```shell docker build -t owncloud/eos-ocis-dev:latest . ``` ## Publish -``` +```shell docker push owncloud/eos-ocis-dev:latest ``` -## Maintainer +## Maintainer -- [Felix Böhm](https://github.com/felixboehm) +* [Felix Böhm](https://github.com/felixboehm) -## Disclaimer +## Disclaimer Use only for development or testing. Setup is not secured nor tested. -# oCIS development on eos +## oCIS development on eos -## Setup oCIS +### Setup oCIS To build and run your local ocis code with default storage driver -``` +```shell docker run --rm -ti --name ocis -v $PWD:/ocis -p 9200:9200 owncloud/eos-ocis-dev ``` @@ -35,13 +35,13 @@ Data is here: `docker exec -it ocis ll /var/tmp/reva/` Alternative: With the [docker-compose.yml file in ocis repo](https://github.com/owncloud/ocis/blob/master/docker-compose.yml) you can also start ocis via compose: -``` +```shell docker-compose up -d ocis ``` Now try to list the running services -``` +```shell docker-compose exec ocis ./bin/ocis list ``` @@ -49,36 +49,36 @@ docker-compose exec ocis ./bin/ocis list 1. Start the eos cluster and ocis via the compose stack -``` +```shell docker-compose up -d ``` 2. Configure to use eos storage driver instead of default storage driver -- kill the home storage and data providers. we need to switch them to the eoshome driver: +* kill the home storage and data providers. we need to switch them to the eoshome driver: -``` +```shell docker-compose exec ocis ./bin/ocis kill reva-storage-home docker-compose exec ocis ./bin/ocis kill reva-storage-home-data ``` -- restart them with the eoshome driver and a new layout: +* restart them with the eoshome driver and a new layout: -``` +```shell docker-compose exec -e REVA_STORAGE_EOS_LAYOUT="{{substr 0 1 .Username}}/{{.Username}}" -e REVA_STORAGE_HOME_DRIVER=eoshome -d ocis ./bin/ocis run reva-storage-home docker-compose exec -e REVA_STORAGE_EOS_LAYOUT="{{substr 0 1 .Username}}/{{.Username}}" -e REVA_STORAGE_HOME_DATA_DRIVER=eoshome -d ocis ./bin/ocis run reva-storage-home-data ``` -- restart the reva frontend with a new namespace (pointing to the eos storage provider) for the dav files endpoint +* restart the reva frontend with a new namespace (pointing to the eos storage provider) for the dav files endpoint -``` +```shell docker-compose exec ocis ./bin/ocis kill reva-frontend docker-compose exec -e DAV_FILES_NAMESPACE="/eos/" -d ocis ./bin/ocis run reva-frontend ``` -- login with `einstein / relativity`, upload a file to einsteins home and verify the file is there using +* login with `einstein / relativity`, upload a file to einsteins home and verify the file is there using -``` +```shell docker-compose exec ocis eos ls -l /eos/dockertest/reva/users/e/einstein/ -rw-r--r-- 1 einstein users 10 Jul 1 15:24 newfile.txt ``` diff --git a/ocis/docker/eos-ocis/Dockerfile b/ocis/docker/eos-ocis/Dockerfile index ca0b431b1..c59feb3ac 100644 --- a/ocis/docker/eos-ocis/Dockerfile +++ b/ocis/docker/eos-ocis/Dockerfile @@ -21,7 +21,7 @@ RUN cd ocis && go build -v -o bin/ocis -toolexec '/usr/bin/time -v' ./cmd/ocis # build user lookup test program RUN mkdir -p /build -ADD user.go /build/user.go +COPY user.go /build/user.go RUN cd /build && go build -o user user.go diff --git a/ocis/docker/eos-ocis/README.md b/ocis/docker/eos-ocis/README.md index 17a669080..bacad3738 100644 --- a/ocis/docker/eos-ocis/README.md +++ b/ocis/docker/eos-ocis/README.md @@ -4,29 +4,27 @@ Image is based on [owncloud/eos-base](https://hub.docker.com/r/owncloud/eos-base ## Build Build owncloud/ocis master branch -``` +```shell docker build -t owncloud/eos-ocis:latest . ``` Or build a certain branch / tag -``` +```shell docker build -t owncloud/eos-ocis:1.0.0 --build-arg BRANCH=v1.0.0./eos-ocis ``` ## Publish -``` +```shell docker push owncloud/eos-ocis:latest ``` -## Maintainer +## Maintainer -- [Felix Böhm](https://github.com/felixboehm) + * [Felix Böhm](https://github.com/felixboehm) -## Disclaimer +## Disclaimer Use only for development or testing. Setup is not secured nor tested. ## Example Usage -See https://github.com/owncloud-docker/compose-playground/tree/master/examples/eos-compose - - +See From b349997727029361be190efeb6d2611c75b4b5a4 Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Wed, 14 Oct 2020 10:09:34 +0200 Subject: [PATCH 4/6] Add dry run for eos-ocis --- .drone.star | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.drone.star b/.drone.star index 38573fe08..69803f20e 100644 --- a/.drone.star +++ b/.drone.star @@ -117,7 +117,7 @@ def main(ctx): updateDeployment(ctx) ] - if '[docs-only]' in ctx.build.title: + if '[docs-only]' in (ctx.build.title + ctx.build.message): pipelines = docs(ctx) pipelines['depends_on'] = [] else: @@ -700,6 +700,25 @@ def docker(ctx, arch): }, }, }, + { + 'name': 'dryrun-eos-docker', + 'image': 'plugins/docker:18.09', + 'pull': 'always', + 'settings': { + 'dry_run': True, + 'context': 'ocis/docker/eos-ocis', + 'tags': 'linux-%s' % (arch), + 'dockerfile': 'ocis/docker/eos-ocis/Dockerfile', + 'repo': 'owncloud/eos-ocis', + }, + 'when': { + 'ref': { + 'include': [ + 'refs/pull/**', + ], + }, + }, + }, { 'name': 'docker', 'image': 'plugins/docker:18.09', From 41df78fc32c5bca271fd787c81a1712249a29acb Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Wed, 14 Oct 2020 12:19:51 +0200 Subject: [PATCH 5/6] rename protoc-gen-swagger to protoc-gen-openapiv2 --- accounts/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/accounts/Makefile b/accounts/Makefile index e24072510..1e9a46955 100644 --- a/accounts/Makefile +++ b/accounts/Makefile @@ -156,8 +156,8 @@ $(GOPATH)/bin/protoc-gen-micro: $(GOPATH)/bin/protoc-gen-microweb: GO111MODULE=off go get -v github.com/owncloud/protoc-gen-microweb -$(GOPATH)/bin/protoc-gen-swagger: - GO111MODULE=off go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger +$(GOPATH)/bin/protoc-gen-openapiv2: + GO111MODULE=off go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-openapiv2 $(PROTO_SRC)/accounts.pb.go: $(PROTO_SRC)/accounts.proto protoc \ @@ -186,5 +186,5 @@ $(PROTO_SRC)/accounts.swagger.json: $(PROTO_SRC)/accounts.proto --swagger_out=$(PROTO_SRC) accounts.proto .PHONY: protobuf -protobuf: $(GOPATH)/bin/protoc-gen-go $(GOPATH)/bin/protoc-gen-micro $(GOPATH)/bin/protoc-gen-microweb $(GOPATH)/bin/protoc-gen-swagger \ +protobuf: $(GOPATH)/bin/protoc-gen-go $(GOPATH)/bin/protoc-gen-micro $(GOPATH)/bin/protoc-gen-microweb $(GOPATH)/bin/protoc-gen-openapiv2 \ $(PROTO_SRC)/accounts.pb.go $(PROTO_SRC)/accounts.pb.micro.go $(PROTO_SRC)/accounts.pb.web.go $(PROTO_SRC)/accounts.swagger.json From 5c462a0ca8d1df443dbdf680715b9c581928626f Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Wed, 14 Oct 2020 13:02:03 +0200 Subject: [PATCH 6/6] run build in ocis folder --- .drone.star | 95 ++++++++++++++++++++++++++------- ocis/docker/eos-ocis/Dockerfile | 2 +- 2 files changed, 77 insertions(+), 20 deletions(-) diff --git a/.drone.star b/.drone.star index 69803f20e..0f774295c 100644 --- a/.drone.star +++ b/.drone.star @@ -102,6 +102,7 @@ def main(ctx): docker(ctx, 'amd64'), docker(ctx, 'arm64'), docker(ctx, 'arm'), + dockerEos(ctx), binary(ctx, 'linux'), binary(ctx, 'darwin'), binary(ctx, 'windows'), @@ -700,25 +701,6 @@ def docker(ctx, arch): }, }, }, - { - 'name': 'dryrun-eos-docker', - 'image': 'plugins/docker:18.09', - 'pull': 'always', - 'settings': { - 'dry_run': True, - 'context': 'ocis/docker/eos-ocis', - 'tags': 'linux-%s' % (arch), - 'dockerfile': 'ocis/docker/eos-ocis/Dockerfile', - 'repo': 'owncloud/eos-ocis', - }, - 'when': { - 'ref': { - 'include': [ - 'refs/pull/**', - ], - }, - }, - }, { 'name': 'docker', 'image': 'plugins/docker:18.09', @@ -761,6 +743,79 @@ def docker(ctx, arch): }, } +def dockerEos(ctx): + return { + 'kind': 'pipeline', + 'type': 'docker', + 'name': 'docker-eos-ocis', + 'platform': { + 'os': 'linux', + 'arch': 'amd64', + }, + 'steps': + generate('ocis') + + build() + [ + { + 'name': 'dryrun-eos-ocis', + 'image': 'plugins/docker:18.09', + 'pull': 'always', + 'settings': { + 'dry_run': True, + 'context': 'ocis/docker/eos-ocis', + 'tags': 'linux-eos-ocis', + 'dockerfile': 'ocis/docker/eos-ocis/Dockerfile', + 'repo': 'owncloud/eos-ocis', + }, + 'when': { + 'ref': { + 'include': [ + 'refs/pull/**', + ], + }, + }, + }, + { + 'name': 'docker-eos-ocis', + 'image': 'plugins/docker:18.09', + 'pull': 'always', + 'settings': { + 'username': { + 'from_secret': 'docker_username', + }, + 'password': { + 'from_secret': 'docker_password', + }, + 'auto_tag': True, + 'context': 'ocis/docker/eos-ocis', + 'auto_tag_suffix': 'linux-amd64', + 'dockerfile': 'ocis/docker/eos-ocis/Dockerfile', + 'repo': 'owncloud/eos-ocis', + }, + 'when': { + 'ref': { + 'exclude': [ + 'refs/pull/**', + ], + }, + }, + }, + ], + 'volumes': [ + { + 'name': 'gopath', + 'temp': {}, + }, + ], + 'depends_on': getDependsOnAllTestPipelines(ctx), + 'trigger': { + 'ref': [ + 'refs/heads/master', + 'refs/tags/v*', + 'refs/pull/**', + ], + }, + } + def binary(ctx, name): if ctx.build.event == "tag": settings = { @@ -994,6 +1049,7 @@ def manifest(ctx): 'docker-amd64', 'docker-arm64', 'docker-arm', + 'docker-eos-ocis', 'binaries-linux', 'binaries-darwin', 'binaries-windows', @@ -1148,6 +1204,7 @@ def badges(ctx): 'docker-amd64', 'docker-arm64', 'docker-arm', + 'docker-eos-ocis', ], 'trigger': { 'ref': [ diff --git a/ocis/docker/eos-ocis/Dockerfile b/ocis/docker/eos-ocis/Dockerfile index c59feb3ac..eb63a782a 100644 --- a/ocis/docker/eos-ocis/Dockerfile +++ b/ocis/docker/eos-ocis/Dockerfile @@ -16,7 +16,7 @@ RUN ln -s /usr/local/go/bin/* /usr/local/bin RUN git clone https://github.com/owncloud/ocis.git RUN cd ocis && git checkout ${BRANCH} RUN cd ocis && git log -n 1 -RUN cd ocis && go build -v -o bin/ocis -toolexec '/usr/bin/time -v' ./cmd/ocis +RUN cd ocis/ocis && go build -v -o ../bin/ocis -toolexec '/usr/bin/time -v' ./cmd/ocis # RUN cd ocis && make generate bin/ocis # build user lookup test program