Skip to content

Instantly share code, notes, and snippets.

@MirKml
MirKml / dotnetCLI.md
Last active April 8, 2018 12:52
list of useful commands for .net core
  • Create empty MVC project.
$ dotnet new mvc -n MyWebProject

Support for entity framework core for current database

For example for sqlite database. All dotnet commands must be executed under current dotnet project directory.

  1. add nuget package for EF Core provider for database type (sqlite, mysql, ...)
$ dotnet add package Microsoft.EntityFrameworkCore.Sqlite
@MirKml
MirKml / docker-working.md
Last active October 20, 2019 13:07
docker-working.md

Build image

If we ha Dockerfile in current directory

$ docker build -t <imageTagName> [--target=<targetName>] .

Builds docker image with particular tag according Dockerfile from current directory. COPY during build - is relative to direcotory with Dockerfile, is relative to WORKDIR

Run image

On each Azure Pipelines agent docker image, there is installed node.js in special directory. You can utilize this one for your task, so there isn't necessary to install node.js into your build machine.

Node is currently in version 10 in special directory /azp/agent/externals/node10" inside Azure Pipelines agent. For runninng your node.js scripts directly

  1. Adjust the PATH environment variable in first pipeline Bash task, use this inline code
 # adjust PATH variable, is preserved for subsequent tasks
 echo "##vso[task.setvariable variable=PATH]$PATH:/azp/agent/externals/node10/bin"

Workflow

  1. New bug of feature issue in issue tracker arrives.
  2. Then create branch from master for particular bug or feature.
$ git pull
$ git checkout master
$ git checkout -b feature-or-bug-<issueNumber>

... code ...

@MirKml
MirKml / azure-devopsAPI-curl.md
Last active January 9, 2023 13:48
Azure devops API curl queries
  1. Gets PAT - personal access token - from azure devops profile. See more on this page.
    You can use username:password from 'Alternate credentials', which is also in your profile.

  2. Use curl with -s - silent, doesn't print statistics. Use jq tool for pritty print json content.

> curl -s -u username:PAT -H "Content-Type: application/json" https://dev.azure.com/<organization>/_apis/projects?api-version=2.0 | jq

You can use authorization header directly from the bash tasks from some build/release pipeline with System.AccessToken pipeline variable

> curl -H "Authorization: Bearer $(System.AccessToken)" -H "Content-Type: application/json" \