-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjfrog.py
More file actions
34 lines (27 loc) · 1 KB
/
jfrog.py
File metadata and controls
34 lines (27 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python3
import requests
import subprocess
def jfrogUpload():
url = "http://65.0.179.169:8082/artifactory/example-repo-local/kubernetes-configmap-reload-0.0.1-SNAPSHOT.jar"
file_path = "/var/lib/jenkins/workspace/NewPipeline/target/kubernetes-configmap-reload-0.0.1-SNAPSHOT.jar"
username = 'admin'
password = 'admin123'
with open(file_path,'rb') as file:
response = requests.put(url, auth=(username, password), data=file)
if response.status_code == 201:
print("\nPUT request was successful!")
else:
print(f"PUT reuquest failed with status code(response.status_code)")
print("Response content:")
print(response.text)
def mvnBuild():
maven_command = "mvn clean install -DskipTests"
try:
print("\nMaven build completed succesfully.")
except subprocess.CalledProcessError as e:
print(f"Error: Maven build failed with exit code (e.returncode)")
def main():
mvnBuild()
jfrogUpload()
if __name__=="__main__":
main()