Xcode Bots Set Current Integration Number - osx-server

I had to restore my OSX Server from backup and now the latest integration number is lower than I need it to be. I am using the integration number to set the build number for beta distribution.
Is there a way to set the current integration number i.e. XCS_INTEGRATION_NUMBER?

Xcode server has a REST API that allows changing the integration counter value.
Basically, you can use cURL to update the integration counter with the following command:
curl -u <xcode-server-user>:<password> -H "Content-Type: application/json" -X PATCH -d '{"set_props":{"integration_counter":<desired-integration-counter>}}'
--insecure https://<xcode-server-address>:20343/api/bots/<bot-id>
The bot-id can be obtained easily from any of the past integration logs.
For more information, check out the documentation here:
https://developer.apple.com/library/content/documentation/Xcode/Conceptual/XcodeServerAPIReference/Bots.html
And also, the answer to this question:
https://forums.developer.apple.com/thread/19868

Related

How do I specify multiple node values in a buildWithParameters call to Jenkins?

I have a webhook service which kicks off a buildWithParameters Jenkins job, and I want to be able to specify which buildservers are being used.
This is easy enough in the job configuration - I've added a Node parameter which lets me specify which nodes are valid, and when starting the job manually in the Jenkins web UI, I can select which nodes I want:
I'm able to kick off the job via curl using the buildWithParameters Jenkins feature:
curl -vvv 'https://webhook:examplepassword#jenkins.example.com/job/build-sideboard-plugin/buildWithParameters?token=exampletoken&GIT_REPO=example/repo&YUM_REPO=example&BUILDSERVER=sideboard.build.dev.xr'
However, I can't figure out how to specify multiple parameters. I expected that I'd simply be able to add a second &BUILDSERVER=xxx value and have that work, but running this:
curl -vvv 'https://webhook:examplepassword#jenkins.example.com/job/build-sideboard-plugin/buildWithParameters?token=exampletoken&GIT_REPO=example/repo&YUM_REPO=example&BUILDSERVER=sideboard.build.dev.xr&BUILDSERVER=sideboard.rocky8.build.dev.xr'
Returns a 500 error. I also tried providing a single value with a comma separating the two values, i.e.
curl -vvv 'https://webhook:examplepassword#jenkins.example.com/job/build-sideboard-plugin/buildWithParameters?token=exampletoken&GIT_REPO=example/repo&YUM_REPO=example&BUILDSERVER=sideboard.build.dev.xr,sideboard.rocky8.build.dev.xr'
but Jenkins interpreted that as a single Node value which didn't match any node since there's no node named sideboard.build.dev.xr,sideboard.rocky8.build.dev.xr. I got the same result when submitting the two values separated by a space.
Is there any way to get Jenkins to do this while still using the buildWithParameter functionality? I'd hate to have to redo the structure of our build triggering or switch to Jenkins Pipeline. Even making 2 different curl commands would be somewhat of a pain given how our webhooks are structured, so I'd love to be able to provide both parameters just like I can in the Jenkins web UI.
I don't think it is possible using the query parameters like you have tried, due to the fact the the plugin actually triggers two different builds.
What you can do is pass the parameters with the submit command as JSON data, which will simulate the trigger of the build with multiple servers selected.
The general syntax will be something like:
curl -u USER:PASSWORD --show-error \
--data 'json={"parameter":[{"name":"PARAMNAME","value":["node1","node2"]}]}' \
http://localhost:8080/job/remote/build?token=TOKEN
or in your case:
curl -u webhook:examplepassword --show-error \
--data 'json={"parameter":[{"name":"BUILDSERVER","value":["sideboard.build.dev.xr","sideboard.rocky8.build.dev.xr"]}]}' \
https://jenkins.example.com/job/build-sideboard-plugin/build?token=exampletoken
You can of course pass all other needed parameters alongside the BUILDSERVERin the JSON data:
curl -u webhook:examplepassword --show-error \
--data 'json={"parameter":[{"name":"BUILDSERVER","value":["sideboard.build.dev.xr","sideboard.rocky8.build.dev.xr"]},{"name":"YUM_REPO","value":"example"},{"name":"GIT_REPO","value":"=example/repo"}]}' \
https://jenkins.example.com/job/build-sideboard-plugin/build?token=exampletoken
In addition it is probably better to use the --data-urlencode instead of the --data flag for the curl commands to avoid encoding issues in case the values of your parameters have special characters.
More info on submitting jobs via Remote Access API is available Here.

twilio. An error occurs when deploying with plugin

If you deploy using the command below,
twilio flex:plugins:deploy --changelog='first deploy'
The following error will occur.
I don't understand the meaning of the path pointed to by resource.
Error code 20404 from Twilio: The requested resource /Services/ZSXXXXXXXXXXXXXXXXXXXXXXX/Environments was not found. See https://www.twilio.com/docs/errors/20404 for more info.
This is the first deployment that has not been deployed yet.
What should i do?
twilio serverless:deploy
Using the above command, functions and assets are deployed on a serverless basis.
At that time, I have deleted the Services of functions and assets that existed by default.
Is this default Services relevant for plugins?
Also, if it is related, where is the part to reset in the plug-in?
When I contacted support, they told me to run the reset command.
curl https://flex-api.twilio.com/v1/Configuration \
-H "Content-Type: application/json" \
-d '{"account_sid":"ACCOUNT_SID", "serverless_service_sids": []}' \
-u ACCOUNT_SID:AUTH_TOKEN
If you deploy again after executing the above command
I was able to deploy without problems.

Is there any way to store or update a file to One-drive after Jenkins build run?

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.

Using REST API to deploy Liberty Docker containers

Has anyone been able to use the WebSphere Liberty REST API to deploy remote Docker containers? The docs describe all the steps, but I am not able to repeat the results. I get an error when calling REST deploy function (details are posted on the other forum).
If anyone was able to do it - please let me know and would be great if you share how you were able to do it.
Not long after posting this question I tried using the curl command with the JSON header spec and now it works. Here is the curl command I am using that works:
curl --verbose --insecure -X POST --data #docker_deploy.json --header "Content-Type: application/json" -u ${ADMIN_USER}:${ADMIN_PASSWORD} https://${CONTROLLER_HOST_NAME}:${CONTROLLER_PORT}/ibm/api/collective/v1/deployment/deploy

Is there a way to rename a repository on Bitbucket using their API

I couldn't find anything even remotely related in the documentation.
Using the Bitbucket website you can rename a repo as follows:
Go to the repo's overview page, usually https://bitbucket.org/username/oldname/overview
Click the settings cog on the far right end of the menu row !
Instead of 1. and 2. you can type 'r' then 'a' for administration.
Change the name in the Name field.
Click Save repository details.
Be advised that changing the name of the repo will change its URL access too. Previously the access was https://username#bitbucket.org/username/oldname.git Now, however, the repo's URL/Path will be https://username#bitbucket.org/username/newname.git
You can check this by going back to the Overview page, and hovering over the big blue HTTPS button. The bottom of your browser will show that it now points to https://username#bitbucket.org/username/newname.git
If you are using SourceTree you can update the remote's URL by highlighting the local repo in SourceTree and then
Click Repository
Click Repository Settings...
Highlight the row containing the remote branch. Usually origin https://username#bitbucket.org/username/oldname.git
Click Edit
Update the URL/Path field. Change 'oldname.git' to 'newname.git', leave the rest unchanged. So the full path should be https://username#bitbucket.org/username/newname.git
Click OK
For version 2.0 of the API:
According to https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-put
PUT https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug} --data "{\"name\": \"${new_name}\"}"
Using the PUT method allows renaming of a repository.
For version 1.0 of the API:
According to https://confluence.atlassian.com/display/BITBUCKET/repository+Resource+1.0:
PUT https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug} --data "name=new name"
This allows to update the visible name of a repository.
In a unix shell you can use cURL;
curl https://api.bitbucket.org/1.0/repositories/{accountname}/{old_repo_name} --data "name=new_repo_name" -X PUT
Is it possible for a user to authenticate in private repositories, but still have only administrators able to execute:
curl https://USER:PASS#api.bitbucket.org/1.0/repositories/{accountname}/{old_repo_name} --data "name=new_repo_name" -X PUT
Just in case anyone hits this with looking for a solution to an old version of the bitbucket API (in my case 5.14.0) to say the documentation on this version is lacking is being quite polite.
curl --location --request PUT 'https://git.local.install/rest/api/1.0/projects/aa/repos/my-repo' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic .....' \
--data-raw '{"name":"my-new-name"}'
According to the lastest API here is the correct curl command:
curl -X PUT --user username:password https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug} --data "name=newRepoName"
Note that the repo_slug is the repository name IN LOWER CASE. If you don't put it all in lower case you would get the not so expressive answer "Not Found".
If you are not sure what is the repository slug execute the following command, which shows you the user's information including current repositories, and look for the field "slug"
curl --user username:password https://bitbucket.org/api/1.0/user

Resources