#1: push main.py
Some checks reported errors
continuous-integration/drone/push Build was killed
Some checks reported errors
continuous-integration/drone/push Build was killed
This commit is contained in:
parent
315d58ced3
commit
e8fe72a68f
32
.drone.yml
Normal file
32
.drone.yml
Normal 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
20
BringCookies/main.py
Normal 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
13
Dockerfile
Normal 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
1
requirements.txt
Normal file
@ -0,0 +1 @@
|
||||
requests
|
Loading…
Reference in New Issue
Block a user