create multiple jira issues for multiple jira keys using ansible - unix

I am new to ansible and trying to create issues in jira using ansible loops concept.
For each jira key (ANS, SEL, PYC) need to create 5 following issues
Requirements
Deployment
Analysis
Build
Delivery
I've written following code
---
- name: create jira issues for multiple project keys
jira:
uri: http://jiraurlhost:8080
username: user
password: pass
project: {{ item.0 }}
operation: create
summary: {{ item.1 }}
description: Created using Ansible
issuetype: Task
with_nested:
- [ ANS, SEL, PYC ]
- [ Requirements, Deployment, Analysis, Build, Delivery ]
I tried using with_nested as well but ansible throws error. How can I solve this problem.

Related

How to set 'Team name' while publishing pact contracts to pactflow?

We recently started using pactflow tool for contract testing. In pactflow we can create different teams. But while publishing pacts to pactflow how to set the 'team name' or use team uuid ? we are using pact CLI to publish pacts.
we are using the below pact CLI cmd to publish pacts. There is no supported arguments for 'publish' command to set team-uuid. We use --team-uuid when using 'create-webhook' command, looking for something similar for 'publish' command
docker run --rm -v ${PWD}:${PWD}
pactfoundation/pact-cli publish ${{ pact_folder_path }}
--consumer-app-version ${{ git_commit_version }}
--tag ${{ git_branch }}
--broker-base-url ${{ pact_broker_url }}
--broker-token ${{ pact_broker_token }}
The application to team association is done through the team UI.
You can associate applications (pacticipants) and users to a team. Any contract publications will use this association.
We currently don't have a specific CLI command to add the team to the publish, and the default behaviour is to assign to the "default" team.

R-CMD-check GitHub Actions workflow failing on warnings/notes

In the repository of my R package, I set a GitHub Actions workflow for the R CMD check command, following the examples shown in the usethis package documentation (with the usethis::use_github_actions() command).
I noticed that my workflow is marked as Fail even if only warnings and notes are found (i.e. no errors).
Is there a way to mark runs without errors as a Pass? Like a flag in the .github/workflows/R-CMD-check.yaml file
The following is a part of my current .yaml file. I tried adding the R_REMOTES_NO_ERRORS_FROM_WARNINGS: true line but the change was uneffective.
name: R-CMD-check
jobs:
R-CMD-check:
runs-on: ubuntu-latest
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
steps:
...
I realized the problem was in the actual part of the file calling the rcmdcheck() function, which is automatically created and uses an already implemented workflow, check-r-package.
Therefore, the problem is solved by modifying the .github/workflows/R-CMD-check.yaml file as follows:
- uses: r-lib/actions/check-r-package#v1
with:
error-on: '"error"'
In this way, we can set the arguments to the rcmdcheck::rcmdcheck(...) command which is internally run by r-lib/actions/check-r-package#v1. Under with, you can set the arguments of rcmdcheck(...) as you wish, and you can modify the internal call to the function.
Anyway, at this link https://github.com/r-lib/actions you can find the arguments/flags you can use in the workflows already implemented, also in the workflows to install the dependencies ecc.

How to configure .net core 3.1 appsettings to run tests on Github actions

I'm developing a web API using .Net core 3.1 trying to integrate it to Github Actions to run the integration tests when a pull request is created.
I'm using the secrets manager to store my API tokens and other sensitive data in development mode
secrets.json
{
"Firebase": {
"Login": "foo#bar.com",
"Password": "FooBar",
"Url": "foobar.firebaseapp.com "
},
}
And on GitHub I've tried to add Secrets(GitHub secrets = environment variables) with the same names I have on my secrets JSON but it hasn't worked.
The GitHub secrets that I've created are like
(KEY - VALUE)
LOGIN - foo#bar.com
PASSWORD - FooBar
And on my test class, I'm invoking the environment variables using the following configuration before the tests
public MyTestClass()
{
var builder = new ConfigurationBuilder()
.AddUserSecrets<MyTestClass>()
.AddEnvironmentVariables();
Configuration = builder.Build();
_settings = Configuration.Get<Settings>();
}
And my .yml looks like
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v2
- name: Setup .NET Core
uses: actions/setup-dotnet#v1
with:
dotnet-version: 3.1.300
- name: Nuget
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --no-restore --verbosity normal
env:
LOGIN: ${{ secrets.LOGIN }}
PASSWORD: ${{ secrets.PASSWORD}}
URL: ${{ secrets.URL}}
How can I load the Settings when executing inside GitHub Actions?
Not sure if i'm not stating the obvious (you didn't mention how you start test app), but GitHub secrets != environment variables. They can be, if user wants that, but it's not done automagically.
- run: program.exe
In this case, program won't know login/password, as there's no way it can access this data.
- run: program.exe
env:
LOGIN: ${{ secrets.LOGIN }}
PASSWORD: ${{ secrets.PASSWORD }}
In this case, program will know login/password, as secrets are "converted" to environment variables, which application can see.
- run: program.exe --login=${{ secrets.LOGIN }} --password=${{ secrets.PASSWORD }}
In this case, program will know login/password, as secrets are passed via command line arguments, which application can see. Environment variables remain unchanged in this case.
Another option is to keep encrypted secrets.json in repository, and decrypt it when workflow is running; see docs for details.

How to create/deploy multiple instance of tomcat in single server

I have excercise where i have to deploy app war files onto multiple tomcat instances available on the same server. I am using Salt has my configuration mangement tool here, i have also gone through some examples of salt orchestrate runner but nothing seems to help. I am also confused arranging the pillar variables for multiple instances in the pillar file.
I am able to deploy app on only instance without any trouble.
Pillar file :
appname:
name : location to instance1 webapps folder
typer : war
State File:
archive.download:
download the war directly to instance1 webapp folder
cmd.run
restart instance1
Need help to include the second instance details and achieving the state deployment in optimized way possible. Thanks.
You might be able to use on the pillar side an array and then a jinja loop for the installation in the state file.
pillar:
applist:
- location : salt://path_to_archive_wi1
destination: /webapps_i1
name: test1
typer : war
- location : salt://path_to_archive_wi2
destination: /webapps_i2
name: test2
typer : war
- location : salt://path_to_archive_wi3
destination: /webapps_i3
name: test3
typer : war
state file:
{%- for app in salt['pillar.get']("applist",[]) %}
copy {{ app[name] }} :
file.managed:
- name: {{ app['destination'] }}
- source: {{ app['location'] }}
{%- endfor %}
Something like this should do it.
In the loop if you are only installing one app in one instance, you can also restart the instance.

Use Google Cloud Build to deploy Firebase without Firebase CI token

In my package.json I have this line:
{
"deploy:ci": firebase deploy --force --only functions --token \"$SECRET\"
}
And my cloudbuild.yaml:
steps:
- name: "gcr.io/cloud-builders/docker"
args: ["build", "--tag", "gcr.io/$PROJECT_ID/functions", "."]
- name: "gcr.io/$PROJECT_ID/functions"
args: ["yarn", "deploy:ci"]
secretEnv: ["FIREBASE_TOKEN"]
secrets:
- kmsKeyName: projects/myproject/locations/global/keyRings/enviroment/cryptoKeys/firebase
secretEnv:
FIREBASE_TOKEN: VERY_LONG_UNGLY_AND_BORING_BASE64_STRING
I want to know if it is possible to add some "special" permissions to the cloudbuild in order to allow the deployment without this FIREBASE_TOKEN.
(all files are in the same project)
yes, it is possible. But there are couple of stuff you need to do
assuming your cloud build looks like this
steps:
- name: "gcr.io/cloud-builders/npm"
args: ["install"]
- name: "gcr.io/cloud-builders/npm"
args: ["run", "build]
- name: "gcr.io/cloud-builders/firebase"
args: ["deploy"]
You need to upload your own firebase image from here, I assume you are already familiar with this, otherwise, I wrote basically a similar post about how to do this part here anyway...
After that, the IAM you are asking for is Firebase Admin, you need to assign this to your ...#cloudbuild.gserviceaccount.com account.
Voila! you can test it like (using the sdk)
gcloud builds submit --config cloudbuild.yaml .
Of course point to your file location.
Opinionated comment: I'm not a big fan of this approach, I tried a few times and there were always some issues with it, but well, that's why we called it opinionated comment :)
Good luck.

Resources