how to validate the Azure CLI or az command before execute? - azure-resource-manager

Looking for a way to validate the AZ command result before the actual implementation.
Below is the command I want to test, The requirement is that, i need to validate the result before applying the command. I know this is possible in ARM template deployment, but is it not allowed in AzureCLI ?
az monitor metrics alert condition create --aggregation {Average, Count, Maximum, Minimum, Total}
--metric
--op {Equals, GreaterOrLessThan, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual, NotEquals}
--type {dynamic, static}
[--dimension]
[--namespace]
[--num-periods]
[--num-violations]
[--sensitivity {High, Low, Medium}]
[--since]
[--skip-metric-validation {false, true}]
[--subscription]
[--threshold]

AFAIK, Whatif is only available for az group or subscription deployment and it cant be used in a single line or direct mode az commands.
There is debug option in other az cmd but i don't think it will serve your purpose.
For more information please refer the below links:
ARM template deployment what-if operation| MS DOC
Az deployment|MS DOC
Az CLI reference| MS DOC

Related

How set feature by id via Data Hub CLI?

Could you please help me to find proper command in HERE CLI that to request of feature by id ?
I am trying it now, but it's return all features:
here xyz show MY_SPACE_ID --feature MY_SPACE_ID,MY_FEATURE_ID
the proper command is:
here xyz show MY_SPACE_ID -s "f.id=MY_FEATURE_ID" -r

Artifcatory: Error when using artifactory docker bitbucket pipeline

I am passing the following
- pipe: JfrogDev/artifactory-docker:0.2.12
variables:
ARTIFACTORY_URL: "${JFROG_URL}"
ARTIFACTORY_USER: "${JFROG_USER}"
ARTIFACTORY_PASSWORD: "${JFROG_PASSWORD}"
DOCKER_IMAGE_TAG: "xxxx/web-interface:${BITBUCKET_BUILD_NUMBER}"
DOCKER_TARGET_REPO: "local-containers"
And I am getting back the following
Status: Downloaded newer image for jfrog-int-docker-open-docker.bintray.io/artifactory-docker:0.2.12
INFO: Starting pipe execution...
jfrog rt config --url=$JFROG_URL --user=$JFROG_USER --password=$JFROG_PASSWORD --interactive=false
[Error] Wrong number of arguments. You can read the documentation at https://www.jfrog.com/confluence/display/CLI/JFrog+CLI
It can’t find anything wrong based on the documentation, it looks like the pipeline makes a cli call and that call is failing
It looks like there is an issue when trying to config the server without the mandatory server-id argument:
https://bitbucket.org/JfrogDev/artifactory-docker/src/3b32b5d01d31c07acadb2a0d29a240110f88d59d/pipe/pipe.sh#lines-65
Instead, you can use the new jfrog-setup-cli pipe. This pipe downloads and configures the JFrog CLI.
For example, in your case:
- pipe: jfrog/jfrog-setup-cli:1.0.0
- source ./jfrog-setup-cli.sh
- jfrog rt docker-push "xxxx/web-interface:${BITBUCKET_BUILD_NUMBER}" local-containers
It requires to populate one secured environment variable prefixed by JF_ARTIFACTORY_ (i.e. JF_ARTIFACTORY_MYSERVER) with a JFrog CLI server token. This token created locally in your machine using the jfrog rt config export command.
Read more about this pipe here.
Read more about the jfrog rt config export command here.

How to delete GAVs in Nexus 3 through Nexus REST API

Is there a way to delete GAVs through a REST API in Nexus 3? From various
google searches it appears that this capability existed in Nexus 2, but not in
Nexus 3 yet. Is that true?
I tried the following with my current Nexus installation, which is OSS 3.2.1-01:
I was trying to delete GAV:
groupId = org.mycompany.myproject
artifactId = myartifact
version = 1.0.0
$ curl --request DELETE --user "USERNAME:PASSWORD" --write-out '%{http_code}\n' http://my-server:8081/service/local/repositories/my-repo/content/org.mycompany.myproject/myartifact/1.0.0
This gave me a 405.
I also looked at the release notes for 3.3 through 3.5 and nothing jumped out
that REST API support was added.
I also looked into
https://help.sonatype.com/display/NXRM3/REST+and+Integration+API. I downloaded
the nexus-book-examples and downloaded several of the Javadocs (nexus-core,
nexus-repository, nexus-common, nexus-script, nexus-commands, nexus-selector)
for version 3.2.1-01 and started to look through the code. It was not clear
where to start with a simple program to delete GAVs.
Am I correct that you cannot delete GAVs through the REST API in Nexus 3? Is
there a plan to support this in a future Nexus 3 release? Is there a way to do
what I want to do by creating a Groovy script using the code referenced by the
REST+and+Integration+API link above? Is there some sample code which will help
bootstrap me to using the above code (either 3.2.1-01, or a newer version of
Nexus).
Thanks.
You might take a look at our Beta REST API in Nexus Repository 3. Upgrade to a version greater than 3.3, preferably to 3.5 (just so you are using latest and greatest) and navigate to:
http://nexushostname:nexusport/swagger-ui/
Since the REST API is currently Beta we have yet to publish documentation or fanfare around it while we let people experiment with it and give us feedback.
You should see endpoints for deleting components and assets. You will likely want to use the component delete, so that it will clean up all associated assets.
Let me know your mileage!
According to the documentation, you can delete an ASSET (individual file) or a COMPONENT (a set of files, like jar+md5+sha1+pom.xml representing an artifact) only if you know the assetId or the componentId
https://help.sonatype.com/repomanager3/rest-and-integration-api/components-api
https://help.sonatype.com/repomanager3/rest-and-integration-api/assets-api
So you should issue a separate search call passing the GAV and finding out the componentId, then use the componentId to delete in a second call.
However I see here https://issues.sonatype.org/browse/NEXUS-11266 and here
https://issues.sonatype.org/browse/NEXUS-11881 that people can delete an asset just by specifying the entire path... I have tried with
curl -u admin:admin123 -X "DELETE" -w "%{http_code}" http://localhost:8081/repository/deployments/org/apache/commons/commons-compress/1.18/commons-compress-1.18.jar
and it gives me a HTTP 204 (no content). In my case "deployments" is a hosted repository. I have tried the same command on "central" (aproxy repo) and I get a 405.
But if I try to download the whole component (including pom, sha1 etc) with
curl -u admin:admin123 -X "DELETE" -w "%{http_code}" http://localhost:8081/repository/deployments/org/apache/commons/commons-compress/1.18/
I get a HTTP 404.
I know, it's painful and in Nexus2 it was much easier.

how to post and accept long text to ASP.net web api?

I am trying to figure out the parameters and class fields to post and accept "build notes"(example text below) info,I am trying to design my controller as follows?would the following work for accepting a long text?
Controller:
public IEnumerable<class name> GetBuildNotes([FromBody] Buildnotes buildNotes>)
{
...........
........
}
Buildnotes class:
public class buildnotes
{
public string build_notes. --> this goes to a database column build_notes of type longtext
.....
}
Long text:
CHECKOUT POINT
cld3 - 1855314
cmn - 1855287
Known issue
[testsuite: STA_5G_VHT]: COMDEBUG-276224: consistent crash : APPS Crash - Kernel BUG at ffffff82dc55994c [PC at reg_todo+0x1dc/0x260] [LR at reg_todo]
if you observe build loading issue.please use fastboot.exe path : \\\8998_adb_drivers
Latest META only supported on BIN1 MTP. With BINA sometimes its works. but observed random boot-up crash
BIN B MTP doesn't boot up with latest target meta
Expected behavior :Bootloader UI updated with Boot verify feature in UEFI where the signing of the images is verified.
You can use below script to determine the Bin / Sub BIN type and IDDq leakage values thru adb.
Bring up device in adb mode
Source : \\location\team\LA\8998_hw_type\FinalScript
Usage : python bining.py
Please run "adb disable-verity" to avoid "adb remount/push" related issue
Sl4a/ PMC/ Acts/ Comms:Google_testing
$[apps_crm]\source\google_testing
WAPI build
CCX build location
e
HOT FIX
HW used for BIT sanity
Recommendation to use MPT with chipname 2.0 card. please replace chipname card on MTP having MCN ends with 001/003/005
CDT programming forV2 HW
http://qwiki.company.com/qct-drvsw/8998
Pre-built wiki
http://qwiki.company.com/com_wCOM/com-CBI/Build_With_External_AU#BUILDING_DRIVER_POINTING_TO_APPS_CRM
http://qwiki.company.com/com_wCOM/com-CBI/Build_With_External_AU#Build_ROME_and_chip_for_SP_:_com1234.LA.0.1
Build loading procedure
Load BIT (CI) Meta
ENGG WLAN FW load on top of BIT META
adb root
adb remount
adb shell mount -o rw,remount /firmware
adb push wlanmdsp.mbn /firmware/image
adb reboot
ENGG BT FW load on top of BIT META
adb root
adb remount
adb shell mount -o rw,remount /bt_firmware
adb push * /bt_firmware/image
adb reboot
Yes you can, I'm guessing you just need to ensure that the object you're passing from your client application matches your Buildnotes class structure.
Try this:
How to pass json POST data to Web API method as object

Concourse CI and Build number

I'm moving from Jenkins to using using Concourse CI to run my Sauce labs e2e tests. Sauce labs groups tests together that have the same build number string:
name: 'Chrome XS',
browserName: 'chrome',
tunnelIdentifier: process.env.TUNNEL_IDENTIFIER,
build: process.env.JENKINS_BUILD_NUMBER,
platform: 'Windows 10',
shardTestFiles: true,
maxInstances: 20,
How can I pass the build number to my script using an environment variable as shown above. The Concourse GUI uses name #number. Is there any way to retrieve this. I tried printing all the environment variables in the docker container but it's not set by default.
Metadata like the build number/ID are intentionally not provided to tasks. See https://concourse-ci.org/implementing-resources.html#resource-metadata
This sounds like potentially a use case for a Sauce Labs resource?
In Concourse, build metadata is only available for resources, not tasks.
An example on using build metadata with resources is to include it as part of build results notification emails. The following blog entry contains more information about it:
http://lmpsilva.typepad.com/cilounge/2016/10/how-to-insert-build-metadata-into-user-notifications-in-concourse.html
If you really want to use build number for versioning, you could try to create your own Concourse resource that would return the version number, however, I would use your code commit number instead. Another alternative would be to use the Semver resource in Concourse: https://github.com/concourse/semver-resource

Resources