Lokalise: How to use `include_pids` for specific branch - translation

I have two projects on Lokalise (the main project and the shared project),
I also use their API to download the translation files and passing the shared project ID in the include_pids to include the shared translation and it works fine.
request body:
{
"format": "json",
"original_filenames": false,
"export_empty_as": "skip",
"include_pids":["641086835fcfa7214a3a83.13574983"]
}
Now for some reason, I created a new Branch in the shared project and wanted to get that specific branch, I supposed passing the branch name FeatureBranchName would work but it didn't:
{
"format": "json",
"original_filenames": false,
"export_empty_as": "skip",
"include_pids":["641086835fcfa7214a3a83.13574983:FeatureBranchName"]
}
does include_pids work for specific branches?

No, the project_id:branch schema doesn't work for include_pids request parameter at the moment.
You would have to get your branch merged to the default one before using translations from the FeatureBranchName branch.

Related

How to update a test execution when importing Junit Multipart using Xray?

I was looking at the documentation of the Xray plugin for Jenkins: https://docs.getxray.app/display/XRAY/Import+Execution+Results+-+REST#ImportExecutionResultsREST-JUnitXMLresultsMultipart
And what I found, is a bit confusing, after a few attempts.
If I'm NOT trying to import executions using the multipart, I can update a test execution by specifying a Test Execution Key.
When I do try the multipart, I have this JSON
"fields": {
"project": {
"key": "${ProjectKey}"
},
"summary": "Temp Test execution",
"issuetype": {
"name": "Test Execution"
},
"labels": [],
"fixVersions": [
{
"name": "testrelease"
}
]
}
}
This always creates a new Test Execution within JIRA.
In their examples I see no way to send the test execution key for it to be updated.
Which is strange, because by importing without multipart, I can set it.
Anyone has any idea how to achieve this?
Currently, if you use the "multipart" kind of endpoints, a new Test Execution will always be created. To update existing Test Execution issues you need to use the standard endpoints (e.g., JUnit); however, these don't allow you to customize fields on the Test Execution.
There's an improvement in the backlog in order to enhance the existing behaviour; please vote on it and watch it, so the Xray team can become aware of your interest on this.

How to use "Method: projects.repos.create" to mirror bitbucket repo

I want to Mirror bitbuket repo in Google Source Repository so, what should I need to pass in below json request body.
{
"mirrorConfig": {
"url": "",
"deployKeyId": "",
"webhookId": ""
},
"name": "",
"pubsubConfigs": {}
}```
As mentioned in the projects.repos resource reference, the mirrorConfig field is currently set to read-only, so it is not possible to set any values for it manually.
Currently it is not possible to mirror the repository via the API, you will have to connect to the external sources through the Cloud Console, like explained in the Mirroring a Bitbucket repository documentation.

Multiple target environments and AWSGoogleSignIn

Hello I am working with multiple AWS frameworks on an Ios project. The app is setup to target the specific backend environments though a dev and prod target in xcode.
This generally works fine though the use of constants and macros to use the different identity pools etc on build.
However I am now using AWSGoogleSignInProvider to link google sign-in and cognito. this requires a awsconfiguration.json file in the project which contains the google id and the cognito Id.
{
"Version": "1.0",
"CredentialsProvider": {
"CognitoIdentity": {
"Default": {
"PoolId": "***",
"Region": "***"
}
}
},
"IdentityManager": {
"Default": {}
},
"GoogleSignIn": {
"ClientId-iOS": "***",
"Permissions": "email,profile,openid"
}
}
Im unsure on how i can target dev/prod since i would need to use different pool ids depending on environments. Can't use two files with different names and targets since naming is "immutable" and cant use any macros in the Json file itself.
By looking at the AWS framework it seams there is no way to manually set any of these, and the shared instance gets the google id through the the Json file on instantiation or throws.

Getting Issue Type Scheme and Workflow Scheme for JIRA project using REST API

I'm doing an integration for JIRA using REST API 6.2.6. One thing that I need to do is to get Issue Type Scheme and Workflow Scheme for a project.
What I tried:
Issue Type Scheme
The only thing that I can get right now is a list of issue types using /rest/api/2/project/{projectIdOrKey}. I can't see any way of getting an ID of Issue Type Scheme. Looking at API there is no any endpoints for issue type schemes, so I guess it's not possible.
Workflow Scheme
/rest/api/2/project/{projectIdOrKey} doesn't return any information about Workflow Scheme. But there is an endpoint /rest/api/2/workflowscheme/{id}, so that means that it's possible to get ID somehow... At the end I want to get a list of workflows for a project to check transitions for an issue type.
Question
Is there any way to get the data I want? Maybe there is some hidden not documented API?
Note: I'm using only JIRA REST API.
This is what you want.
/rest/projectconfig/1/workflowscheme/{projectIdOrKey}
Latest Jira documentation provides information about the APIs which can be used to fetch details for issuetype scheme and workflow scheme. Below are the APIs which can be used for the same,
Fetching Issue type Scheme for a project Issuetype Scheme API
Rest URL:GET https://your-domain.atlassian.com/rest/api/2/issuetypescheme/project?projectId={projectId}'
Sample Response:
{
"maxResults": 100,
"startAt": 0,
"total": 3,
"isLast": true,
"values": [
{
"issueTypeScheme": {
"id": "10000",
"name": "Default Issue Type Scheme",
"description": "Default issue type scheme is the list of global issue types. All newly created issue types will automatically be added to this scheme.",
"defaultIssueTypeId": "10003",
"isDefault": true
},
"projectIds": [
"10000",
"10001"
]
}
]
}
Fetching workflow scheme configured for a project Workflow Scheme API
REST URl: GET https://your-domain.atlassian.com/rest/api/2/workflowscheme/{id}
Sample Response:
{
"id": 101010,
"name": "Example workflow scheme",
"description": "The description of the example workflow scheme.",
"defaultWorkflow": "jira",
"issueTypeMappings": {
"10000": "scrum workflow",
"10001": "builds workflow"
},
"draft": false,
"self": "https://your-domain.atlassian.net/rest/api/2/workflowscheme/101010"
}
As far as I am aware you can get the correct XML or JSON response from the
REST API:
/rest/api/2/project/{projectIdOrKey}.
Then if you want to find out the information about the workflowscheme you can do this programmatically by using the following information.
If you have an issue that you want to use then you can use it to get the workflowscheme id by doing this this:
ComponentAccessor.getWorkflowSchemeManager().getWorkflowScheme(issue.getProject()).get("id");
Then once you get the id of the workflow scheme e.g. 10, you then can get the scheme generic value as follows:
GernericValue scheme = ComponentAccessor.getWorkflowSchemeManager().getScheme(10);
Now that you have the scheme you then can get all of the workflows that are referenced in the scheme by doing this:
Collection<JiraWorkflow> workflows = ComponentAccessor.getWorkflowManager().getWorkflowsFromScheme(scheme);
Then if you want to get one workflow you will have to use:
workflows.iterator().next():
Also note, that workflows are identified by their name in JIRA as there are no id's in JiraWorkflow.
So that would be the approach I would use if I wanted to find out the workflowscheme information so I could use the id to then use the REST API:
But the main reason that you might not be able to find a workflowscheme is because it is not present in the JIRA's Issue.
Using this HTTP and inputting it into "Postman" as a get request will return all the JSON information.
Using this https://jira.atlassian.com/browse/JRA-25121/project/23 will return all the information for that project. Then using this REST API:
/rest/api/2/workflowscheme/{id}
Using this HTTP get request https://jira.atlassian.com/browse/JRA-25121/workflow/45 will get you the returned XML or JSON workflow information too.

How to access full source of old commit in BitBucket?

I can't figure out or find the documentation on how to access the source of an old commit in the new Bit Bucket format. Is this even possible anymore?
I understand you want to download an older version via the BitBucket web interface without using a Mercurial/Git client.
Check this related question. On the comments, someone says that there is no way to do that. Fortunately, that's not entirely true.
By navigating on BitBucket project pages, I found no link to download an arbitrary version. There are links to download specific tags, in the format:
https://bitbucket.org/owner/repository/get/v0.1.2.tar.gz
But by tweaking a bit the url above, changing the tag name by the commit hash, like:
https://bitbucket.org/owner/repository/get/A0B1C2D.tar.gz
You can actually download a specific version.
As mentioned by Rakka Rage in a comment, replacing .tar.gz by .zip works too.
I was trying to figure out if it's possible to browse the code of an earlier commit like you can on GitHub and it brought me here. I used the information I found here, and after fiddling around with the urls, I actually found a way to browse code of old commits as well.
When you're browsing your code the URL is something like:
https://bitbucket.org/user/repo/src/
and by adding a commit hash at the end like this:
https://bitbucket.org/user/repo/src/a0328cb
You can browse the code at the point of that commit. I don't understand why there's no dropdown box for choosing a commit directly, the feature is already there. Strange.
Step 1
Step 2
Step 3
Step 4
Final Step
Just in case anyone is in my boat where none of these answers worked exactly, here's what I did.
Perhaps our in house Bitbucket server is set up a little differently than most, but here's the URL that I'd normally go to just to view the files in the master branch:
https://<BITBUCKET_URL>/projects/<PROJECT_GROUP>/repos/<REPO_NAME>/browse
If I select a different branch than master from the drop down menu, I get this:
https://<BITBUCKET_URL>/projects/<PROJECT_GROUP>/repos/<REPO_NAME>/browse?at=refs%2Fheads%2F<BRANCH_NAME>
So I tried doing this and it worked:
https://<BITBUCKET_URL>/projects/<PROJECT_GROUP>/repos/<REPO_NAME>/browse?at=<COMMIT_ID>
Now I can browse the whole repo as it was at the time of that commit.
Great answers from a couple of years ago. Now Bitbucket has made it easier.
Tag the Commit you want to download (as mentioned in answer by Rudy Matela).
Then head over to Downloads and click the "Tags" tab and you'll get multiple options for download.
For the record, you can also toy around URLs this way :
When browsing the latest source, you have something like :
https://bitbucket.org/my/repo/src/latestcommithash/my.file?at=master
Simply change the commit hash and remove the GET parameter :
https://bitbucket.org/my/repo/src/wantedcommithash/my.file
Got to +1 #Hein A. Grønnestad above : it's all working, really wondering why there's nothing in the GUI to use it.
Add this to the end of any url: ?at=102beada4f1 (using the relevant commit SHA).
Note: the parameter is 'forgotten' with every new page load, so get ctrl + c and ctrl + v ready.
It's astonishing that BitBucket/Stash has no 'Browse files' button in the UI, like GitHub has:
Sigh.
You can view the source of the file up to a particular commit by appending
?until=<sha-of-commit> in the URL (after the file name).
The easiest way is to click on that commit and add a tag to that commit.
I have included the tag 'last_commit' with this commit
Than go to downloads in the left corner of the side nav in bit bucket.
Click on download in the left side
Now click on tags in the nav bar and download the zip from the UI.
Find your tag and download the zip
You can view it on your BitBucket web site
As explained on Atlassian community site, it's enough to go to the Source page (available from left side menu) and put your commit id in the at= query parameter of the url. So, for example, the url will end with ?at=bacf2ad3095.
I know it's too late, but with API 2.0 you can do
from command line with:
curl https://api.bitbucket.org/2.0/repositories/<user>/<repo>/filehistory/<branch>/<path_file>
or in php with:
$data = json_decode(file_get_contents("https://api.bitbucket.org/2.0/repositories/<user>/<repo>/filehistory/<branch>/<path_file>", true));
then you have the history of your file (from the most recent commit to the oldest one):
{
"pagelen": 50,
"values": [
{
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/<user>/<repo>/src/<hash>/<path_file>"
},
"meta": {
"href": "https://api.bitbucket.org/2.0/repositories/<user>/<repo>/src/<HEAD>/<path_file>?format=meta"
},
"history": {
"href": "https://api.bitbucket.org/2.0/repositories/<user>/<repo>/filehistory/<HEAD>/<path_file>"
}
},
"commit": {
"hash": "<HEAD>",
"type": "commit",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/<user>/<repo>/commit/<HEAD>"
},
"html": {
"href": "https://bitbucket.org/<user>/<repo>/commits/<HEAD>"
}
}
},
"attributes": [],
"path": "<path_file>",
"type": "commit_file",
"size": 31
},
{
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/<user>/<repo>/src/<HEAD~1>/<path_file>"
},
"meta": {
"href": "https://api.bitbucket.org/2.0/repositories/<user>/<repo>/src/<HEAD~1>/<path_file>?format=meta"
},
"history": {
"href": "https://api.bitbucket.org/2.0/repositories/<user>/<repo>/filehistory/<HEAD~1>/<path_file>"
}
},
"commit": {
"hash": "<HEAD~1>",
"type": "commit",
"links": {
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/<user>/<repo>/commit/<HEAD~1>"
},
"html": {
"href": "https://bitbucket.org/<user>/<repo>/commits/<HEAD~1>"
}
}
},
"attributes": [],
"path": "<path_file>",
"type": "commit_file",
"size": 20
}
],
"page": 1
}
where values > links > self provides the file at the moment in the history which you can retrieve it with curl <link> or file_get_contents(<link>).
Eventually, from the command line you can filter with:
curl https://api.bitbucket.org/2.0/repositories/<user>/<repo>/filehistory/<branch>/<path_file>?fields=values.links.self
in php, just make a foreach loop on the array $data.
Note: if <path_file> has a / you have to convert it in %2F.
See the doc here: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/filehistory/%7Bnode%7D/%7Bpath%7D
Search it for a long time, and finally, I found how to do it:)
Please check this image which illustrates steps.
In my case with Atlassian Bitbucket v6.10
https://<bitbucket.myserver.it>/projects/<myproject>/repos/<myrepo>/browse?at=<full-commit-hash>

Resources