unable to upload artifact to jfrog - gitlab-ci

I am trying to upload a ogg file to jfrog but I am getting the below error, would you mind helping me with what is wrong? I am running below code in my gitlab-ci file.
++ curl -sSf -H 'X-JFrog-Art-Api: <API_KEY>' -X PUT -T dist/myfile.egg 'https://artifactory.mycompany.com/artifactory/dev/apps/myapp/myfile.egg;released=true;build.number=0.1'
curl: (22) The requested URL returned error: 400
ERROR: Job failed: exit status 1
The pattern for Upload a file to Artifactory with properties (metadata):
$ curl -sSf -H "X-JFrog-Art-Api:<API_KEY>" \
-X PUT \
-T file.zip \
'http(s)://<ARTIFACTORY_URL>/<REPO>/<PATH>/file.zip;released=true;build.number=1.0'
if I change my code as below it is working but it won't create a folder and put myfile.egg inside it.
++ curl -sSf -H 'X-JFrog-Art-Api: <API_KEY>' -X PUT -T dist/myfile.egg 'https://artifactory.mycompany.com/artifactory/dev/apps/myapp;released=true;build.number=0.1'
** additional try:
I tried below code and I am getting another error:
curl -H 'X-JFrog-Art-Api: <API_KEY>' -XPUT 'https://artifactory.mycompany.com/artifactory/dev/apps/myapp/myfile.egg' -T dist/myfile.egg
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 120 0 120 0 0 882 0 --:--:-- --:--:-- --:--:-- 882
{
"errors" : [ {
"status" : 400,
"message" : "Parent apps/myapp must be a folder"
} ]
}Job succeeded

I tried to remove my file and upload the artifact by using below command and it worked.
curl -H "X-JFrog-Art-Api: <API_KEY>" -XDELETE "https://artifactory.mycompany.com/artifactory/dev/apps/myapp/myfile.egg"
curl -H "X-JFrog-Art-Api: <API_KEY>" -XPUT "https://artifactory.mycompany.com/artifactory/dev/apps/myapp/myfile.egg" -T "dist/test.zip"

Related

Trying to Use CFEXECUTE with Curl to Post via API to Rumble

I am trying to convert this example script (from Rumble's Upload API) to using CURL:
curl -F "access_token=XXXXX" \ -F "title=A cool video" \ -F "description=Some detailed description" \ -F "license_type=0" \ -F "channel_id=123" \ -F "video=#video.mp4" \ -F "thumb=#thumbnail.jpg" \ "https://rumble.com/api/simple-upload.php"
I've been trying to get the following code working to upload videos via API to our Rumble account. I'm new to Curl and CFEXECUTE but not new to Coldfusion:
<cfexecute name = "/usr/bin/curl" arguments = "-X POST --insecure https://rumble.com/api/simple-upload.php -F access_token=#access# -F title=#titletouse# - F description=#descript# -F license_type=0 -F channel_id=#channel# -F video=##form.video#" variable="response" timeout = "999"> </cfexecute>
Most of the time the response is: [empty string]
The variables listed are required. I'm pretty sure it IS connecting to Rumble because I tried bunch of different versions and one was without POST and got back JSON response data and another was without an -F before description and got back: { "success": false, "errors": { "description": { "code": "MISSING_OR_INVALID_VALUE" } } }
For example, I tried:
with single quotes around each form field '-F license_type=0'
with -H 'Content-Type:multipart/form-data'
with semi colons between fields: -F licensetype=0;-F channel_id=#channel#
Any suggestions on what I'm doing wrong? I have tried about 30 different things.... and am out of ideas. Thank you!!!!!

Any way to use presigned URL uploads and enforce tagging?

Is there any way to issue a presigned URL to a client to upload a file to S3, and ensure that the uploaded file has certain tags? Using the Python SDK here as an example, this generates a URL as desired:
s3.generate_presigned_url('put_object',
ExpiresIn=3600,
Params=dict(Bucket='foo',
Key='bar',
ContentType='text/plain',
Tagging='foo=bar'))
This is satisfactory when uploading while explicitly providing tags:
$ curl 'https://foo.s3.amazonaws.com/bar?AWSAccessKeyId=...&Signature=...&content-type=text%2Fplain&x-amz-tagging=foo%3Dbar&Expires=1538404508' \
-X PUT
-H 'Content-Type: text/plain' \
-H 'x-amz-tagging: foo=bar' \
--data-binary foobar
However, S3 also accepts the request when omitting -H 'x-amz-tagging: foo=bar', which uploads the object without tags. Since I don't have control over the client, that's… bad.
I've tried creating an empty object first and tagging it, then issuing the presigned URL to it, but PUTting the object replaces it entirely, including removing any tags.
I've tried issuing a presigned POST URL, but that doesn't seem to support the tagging parameter at all:
s3.generate_presigned_post('foo', 'bar', {'tagging': '<Tagging><TagSet><Tag><Key>Foo</Key><Value>Bar</Value></Tag></TagSet></Tagging>'})
$ curl https://foo.s3.amazonaws.com/ \
-F key=bar \
-F 'tagging=<Tagging><TagSet><Tag><Key>Foo</Key><Value>Bar</Value></Tag></TagSet></Tagging>'
-F AWSAccessKeyId=... \
-F policy=... \
-F signature=... \
-F file=#/tmp/foo
<Error><Code>AccessDenied</Code><Message>Invalid according to Policy:
Extra input fields: tagging</Message>...
I simply want to let a client upload a file directly to S3, and ensure that it's tagged a certain way in the process. Any way to do that?
Try the following code:
fields = {
"x-amz-meta-u1": "value1",
"x-amz-meta-u2": "value2"
}
conditions = [
{"x-amz-meta-u1": "value1"},
{"x-amz-meta-u2": "value2"}
]
presignedurl = s3_client.generate_presigned_post(
bucket_name, "YOUR_BUCKET_NAME",
Fields=copy.deepcopy(fields),
Conditions=copy.deepcopy(conditions)
)
Python code:
fields = {
'tagging': '<Tagging><TagSet><Tag><Key>Foo</Key><Value>Bar</Value></Tag></TagSet></Tagging>',
}
conditions = [
{'tagging': '<Tagging><TagSet><Tag><Key>Foo</Key><Value>Bar</Value></Tag></TagSet></Tagging>'}
]
presigned_url = s3_client.generate_presigned_post(
Bucket="foo",
Key="file/key.json",
Fields=copy.deepcopy(fields),
Conditions=copy.deepcopy(conditions)
)
CURL command:
$ curl -v --form-string "tagging=<Tagging><TagSet><Tag><Key>Foo</Key><Value>Bar</Value></Tag></TagSet></Tagging>" \
-F key=file/key.json \
-F x-amz-algorithm=... \
-F x-amz-credential=... \
-F x-amz-date=... \
-F x-amz-security-token=... \
-F policy=...\
-F x-amz-signature=... \
-F file=#key.json \
https://foo.s3.amazonaws.com/
Explanation
It is imperative that --form-string is used in the CURL command, otherwise CURL will interpret the =< as reading in a file!
Also ensure that key.json is in your current working directory for CURL to upload the file to S3 using the pre-signed-url.

Using Apache Bench to load test with JSON on Windows

I'm issuing the following command:
ab -n 100 -c 20 -k -v 1 -H "Accept-Encoding: gzip, deflate" -T "application/json" -p ab-login.txt http://localhost:222/
With the contents of ab-login.txt being:
{username:'user',password:'pass!'}
And I get an error:
Could not stat POST data file (ab-login.txt): Partial results are valid but processing is incomplete
What am I doing wrong?
I added
-v 4 -T 'application/x-www-form-urlencoded'
Also, a line in my post file looked like:
name='myName'
There were no quotes or anything like that.

Rsnapshot Issue

I am trying to do some backups with Rsnapshot and am constantly getting this error:
/usr/bin/rsync -av --delete --numeric-ids --relative --delete-excluded \
--stats -L --whole-file --exclude=*/web/ --exclude=*/tmp/ \
--exclude=*/dms/ --exclude=*/Recycle\ Bin/ --exclude=*/app/logs/ \
--exclude=*/app/cache/ --exclude=*/vendor/ --exclude=/var/www/files/ \
--exclude=*/releases/ \
--exclude=/var/www/www.xxx.net/app/var/sessions/ \
--rsync-path=rsync_wrapper.sh --exclude=/var/www/psan-static/ \
--rsh=/usr/bin/ssh -p 9922 backup#xxx.xxx.xxx.xxx:/var/www \
/data-ext/backups/rsnapshot/daily.0/myserver/
Unexpected remote arg: backup#xxx.xxx.xxx.xxx:/var/www
rsync error: syntax or usage error (code 1) at main.c(1348) [sender=3.1.0]
----------------------------------------------------------------------------
rsnapshot encountered an error! The program was invoked with these options:
/usr/bin/rsnapshot daily
----------------------------------------------------------------------------
ERROR: /usr/bin/rsync returned 1 while processing backup#xxx.xxx.xxx.xxx:/var/www/
/usr/bin/logger -i -p user.err -t rsnapshot /usr/bin/rsnapshot daily: \
ERROR: /usr/bin/rsync returned 1 while processing \
backup#xxx.xxx.xxx.xxx:/var/www/
I was trying to play with parameters but cannot figure out what's the issue
The issue was with the
--exclude=*/Recycle\ Bin/
This needs to be quoted as spaces seems not to work.
--exclude="*/Recycle\ Bin/"

How to create instagram API subscription using cURL

Following the instagram API documentation, I ran the following in the command line:
$ curl -F 'client_id=my_client_id' \
> -F 'client_secret=my_client_secret' \
> -F 'object-geography' \
> -F 'aspect=media' \
> -F 'lat=35.657872' \
> -F 'lng=139.70232' \
> -F 'radius=1000' \
> -F 'callback_url=http://http://requestb.in/my_string' \
> https://api.instagram.com/v1/subscriptions/
and got the following error:
Warning: Illegally formatted input field!
curl: option -F: is badly used here
curl: try 'curl --help' or 'curl --manual' for more information
I did try curl --help and curl --manual, but wasn't able to figure this out based on their contents. How might I successfully create a subscription?
You are facing problem with this one:
> -F 'object-geography' \
It supposed to be Key=Value paired parameter. But you are using only one. So check this out. Probably it will be
> -F 'object=geography' \
^ check this