#1: push main.py
continuous-integration/drone/push Build was killed Details

This commit is contained in:
katharina 2021-12-04 18:17:51 +01:00
parent 315d58ced3
commit e8fe72a68f
4 changed files with 66 additions and 0 deletions

32
.drone.yml Normal file
View File

@ -0,0 +1,32 @@
---
kind: pipeline
type: kubernetes
name: bringCookies
steps:
- name: build image
image: plugins/kaniko
settings:
dockerfile: Dockerfile
repo: katharina1602/drone-nextcloud
username:
from_secret: userdockerhub
password:
from_secret: passworddockerhub
tag:
- latest
- ${DRONE_COMMIT_SHA}
- name: test plugin
image: katharina1602/drone-nextcloud:${DRONE_COMMIT_SHA}
settings:
sourcepath: BringCookies/main.py
destinationpath: TestSourceCode/main.py
nextcloudinstance: cloud.uploadfilter24.eu
user:
from_secret: usernextcloud
password:
from_secret: passwordnextcloud
protocol: https
verifytls: true

20
BringCookies/main.py Normal file
View File

@ -0,0 +1,20 @@
import os
import requests
def main():
env = os.environ
sourcePath = env["PLUGIN_SOURCEPATH"]
destinationPath = env["PLUGIN_DESTINATIONPATH"]
nextcloudInstance = env["PLUGIN_NEXTCLOUDINSTANCE"]
user = env["PLUGIN_USER"]
password = env["PLUGIN_PASSWORD"]
protocol = env["PLUGIN_PROTOCOL"]
verifyTls = env["PLUGIN_VERIFYTLS"]
filecontent = open(sourcePath, "rb")
copy(nextcloudInstance, user, destinationPath, filecontent, password, protocol, verifyTls)
def copy(nc, user, pathtofile, filecontent, password, protocol, verifyTls):
journey = requests.put(protocol + "://" + nc + "/remote.php/dav/files/" + user + "/" + pathtofile, data=filecontent, auth=(user, password), verify=verifyTls)
if __name__ == "__main__":
main()

13
Dockerfile Normal file
View File

@ -0,0 +1,13 @@
FROM python:3.10.0-alpine3.14
RUN mkdir -p /opt/drone/
COPY requirements.txt /opt/drone/
WORKDIR /opt/drone/
RUN pip install -r requirements.txt
COPY BringCookies /opt/drone/
ENTRYPOINT [ "python", "/opt/drone/BringCookies/main.py" ]

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
requests