I'm currently using this command to delete a specific file from a directory
and it works as expected
curl -s -u user_name:password --request DELETE https://host_name/repository/Folder/artifact.py
I would like to delete the Folder Directory using this curl command but this isn't working : (
curl -s -u user_name:password --request DELETE https://host_name/repository/Folder
please help with the command to delete the directory using the curl command.
Thanks in advance : )
This is not possible in Nexus 3. You can follow this enhancement request for the feature on the project's Jira, https://issues.sonatype.org/browse/NEXUS-11881.
The only solution seems to either delete the directory (subtree) manually using the Web UI, as implemented in https://issues.sonatype.org/browse/NEXUS-14682.
Or write a script that will search for all files in the subtree and delete them one by one (after which the empty directories will also disappear), for example something like https://gist.github.com/kamal2222ahmed/c3d65dfac3f2bc26183e7f5e4caa51cd
Related
So I'm having in issue where I want this maven installed war file to be named artifactId##version.war in a curl commands url; in the curl command I tried putting in \ and %23 but both instances I get this message The Path is not formatted correctly - must begin with '/repositories//...' and when its just the name artifactId##version when it pushes or uploads it to the website I want it only names it artifactId and leaves out the rest, the problem isn't in getting the artifactID name or version number or the maven install it's in the curl command portion of the code and the reason why I have two FILE_TO_UPLOAD is because of one is the file name installed and another is whats gonna be the name uploaded and like I said if I just put ## it'll just upload the artifactId
run:|
mvn install
#CODE WHERE THE PROBLEM IS
FILE_TO_UPLOAD="ARTIFACTID\#\#VERSION.war"
FILE_TO_UPLOAD2="ARTIFACTID##VERSION.war"
echo ${FILE_TO_UPLOAD} #for testing
TARGET_URL=https://example.com/PATH/${FILE_TO_UPLOAD}
curl -u 'username:password' --upload-file ${FILE_TO_UPLOAD2} ${TARGET_URL}
#CODE WHERE THE PROBLEM IS
Is there any way to store or update a CSV file to One-drive after Jenkins build run? I want it to happen without any third-party plugin.
You can do this using OneDrive API and curl, e.g.:
curl https://graph.microsoft.com/v1.0/me/drive/root:/data.csv:/content -X PUT -d #data.csv -H "Authorization: bearer access_token_here"
One limitation is that your csv file couldn't be more than 4MB.
I've got a bunch of scripts that get called when the appcenter-pre-build.sh is called. For example, one of them is a simple check to see if the current branch tag already exists on the repository.
#!/usr/bin/env bash
set -e # Exit immediately if a command exits with a non-zero status (failure)
# 1 Fetch tags
git fetch --tags
# See if the tag exists
if git tag --list | egrep -q "^$VERSION_TAG$"
then
echo "Error: Found tag. Exiting."
exit 1
else
git tag $VERSION_TAG
git push origin $VERSION_TAG
fi
If the tag is found, I want to abort the build in AppCenter and fail it. This worked perfectly fine when I was running everything through Xcode Server but for some reason, I cannot figure out how to abort the build upon failure of my script. I'm not seeing much documentation on this particular subject and the AppCenter folk over at Microsoft are taking their sweet time getting back to me.
Anyone have experience with this and/or know how to fail an AppCenter build from their scripts? Thanks in advance for your thoughts!
Okay, figured it out. Looks like sending a curl request to cancel the build using the env variable "$APPCENTER_BUILD_ID" takes care of the issue. Exiting your script with a non-zero is NOT working inside AppCenter.
Here's a sample of what to do. I just put it in a special "cancelAppCenterBuild.sh" script and called it in place of my exits.
API_TOKEN="<YourAppToken>"
OWNER_NAME="<YourOwnerOrOrganizationName>"
APP_NAME="<YourAppName>"
curl -iv "https://appcenter.ms/api/v0.1/apps/$OWNER_NAME/$APP_NAME/builds/$APPCENTER_BUILD_ID" \
-X PATCH \
-d "{\"status\":\"cancelling\"}" \
--header 'Content-Type: application/json' \
--header "X-API-Token: $API_TOKEN"
Pro tip: If you've ever renamed your app, AppCenter servers are having issues referencing the new name. I was getting a 403 with a forbidden message. You might have to change your app name to whatever the original name was or just rebuild the app from scratch within AppCenter.
I have to rename my branch , but having lots of open patches in that branch. How to move those open patches to new branch without cherrypick.
Cherrypick is one of the option , but has to cherry pick every patch.
You can use the REST API to automate this task. You can find the open changes using the Query Changes endpoint (or just the "Search" field in the Gerrit UI) and than change their destination branch using the Move Change endpoint.
For example, you could put all open changes in a file (one change number in each line) and execute the following command:
for c in $(cat CHANGE-FILE)
do
curl -s --request POST --user USER:PASSWORD --data #- --header Content-Type:application/json GERRIT-SERVER/a/changes/CHANGE/move << EOF
{
"destination_branch" : "NEW-BRANCH"
}
EOF
done
I'm following this tutorial http://ruby.railstutorial.org/chapters/updating-showing-and-deleting-users#fnref-9_4 and after the code in Listing 9.44 author says that in that specific moment any user can be deleted with a direct DELETE request from the command line, of course I believe that it's true but I don't know how to check this one
any sufficiently sophisticated attacker could simply issue DELETE requests directly from the command line to delete any user on the site.
Here's an example of a command line DELETE call using cURL
$ curl -X DELETE http://localhost:3000/users/1
http://localhost:3000/ is the path to your app, 1 is the ID of the record to delete.
With cURL you can simulate the same requests you will perform using your browser. You can use any other HTTP client.
You can use cURL from the command line to make HTTP requests, including DELETE requests.
curl -i -H "Accept: application/json" -X DELETE http://localhost:3000/persons/person/1
** Adapted from this blog post