Giter Site home page Giter Site logo

microsoft / devops-project-samples Goto Github PK

View Code? Open in Web Editor NEW
369.0 21.0 1.8K 5.62 MB

Sample applications for Azure DevOps Project

License: MIT License

C# 6.30% CSS 7.28% JavaScript 52.36% HTML 11.44% Java 0.97% PHP 7.16% Vue 0.08% Python 2.20% Smarty 0.44% Go 0.14% Ruby 1.09% PowerShell 1.25% Dockerfile 0.32% TSQL 0.03% ASP.NET 0.01% Stylus 0.16% Pug 0.65% Less 7.49% Shell 0.05% Blade 0.57%

devops-project-samples's Introduction

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

devops-project-samples's People

Contributors

assimilationstheorie avatar aydey avatar azooinmyluggage avatar bishal-pdmsft avatar ddivanshu avatar dependabot[bot] avatar dikhakha avatar hiyadav avatar imalokagrawal avatar issacnitin avatar issacnitinmsft avatar kanika1894 avatar koushdey avatar markharrison avatar microsoftopensource avatar niadak avatar ninadkavimandan avatar plkt avatar pulkitaggarwl avatar rgovardhms avatar sachinma avatar shreyasrmsft avatar suyash691 avatar tejasd1990 avatar thesattiraju avatar upadhyayap avatar vagisha-nidhi avatar vineetmimrot avatar vinodkumar3 avatar xiaomi7732 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

devops-project-samples's Issues

Create Devops using ARM templates fail

Am trying to create DevOps using ARM templates.
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"accountName": {
"type": "string",
"metadata": {
"description": "The name of the Visual Studio Team Services account, if it doesn't exist it will be created."
}
},
"projectName": {
"type": "string",
"metadata": {
"description": "The name of the Visual Studio Team Services project."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for all resources."
}
},
"processTemplateId": {
"type": "string",
"defaultValue": "ADCC42AB-9882-485E-A3ED-7678F01F66BC",
"allowedValues": [
"6B724908-EF14-45CF-84F8-768B5384DA45",
"ADCC42AB-9882-485E-A3ED-7678F01F66BC",
"27450541-8E31-4150-9947-DC59F998FC01"
],
"metadata": {
"description": "Scrum: 6B724908-EF14-45CF-84F8-768B5384DA45 / Agile: ADCC42AB-9882-485E-A3ED-7678F01F66BC / CMMI: 27450541-8E31-4150-9947-DC59F998FC01"
}
},
"versionControlOption": {
"type": "string",
"defaultValue": "Git",
"allowedValues": [
"Git",
"Tfvc"
],
"metadata": {
"description": "The version control of the Visual Studio Team Services project's source code: Git or Tfvc."
}
}
},
"variables": {},
"resources": [
{
"name": "[parameters('accountname')]",
"type": "microsoft.visualstudio/account",
"location":"[parameters('location')]",
"apiVersion": "2014-02-26",
"properties": {
"accountName": "[parameters('accountName')]",
"operationType": "Link"
},
"resources": [
{
"type": "project",
"name": "[parameters('projectName')]",
"apiVersion": "2014-02-26",
"location":"[parameters('location')]",
"dependsOn": [
"[concat('microsoft.visualstudio/account/', parameters('accountName'))]"
],
"properties": {
"ProcessTemplateId": "[parameters('processTemplateId')]",
"VersionControlOption": "[parameters('versionControlOption')]"
}
}
]
}
]
}
But it is failing with following error
'{
"code": "InvalidRequestValue",
"message": "The requesting client principal is invalid.",
"target": "GetRequestorIdentity"
}'

Could someone help me througn this ?

PipelineBootstrapConfigurations

I am trying to create a new Azure DevOps project with bringing your own template concept. I could successfully create the DevOps project, but CI/CD is referencing where I have my reference (some common repository) sample application. I would like to get the reference solution from my common repository and push to the newly created project’s repository. Is it possible?
Here is the template I used:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/Microsoft.Resources.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"projectSettings": {
"type": "Object"
},
"azureAuth": {
"type": "SecureString"
}
},
"variables": {},
"resources": [
{
"type": "microsoft.visualstudio/account",
"name": "[parameters('projectSettings').accountName]",
"apiVersion": "2014-02-26",
"location": "[parameters('projectSettings').accountLocation]",
"properties": {
"operationType": "[parameters('projectSettings').accountOperationType]",
"accountName": "[parameters('projectSettings').accountName]",
"ownerUpn": "[parameters('projectSettings').ownerUpn]"
},
"resources": [
{
"type": "project",
"name": "[parameters('projectSettings').projectName]",
"apiVersion": "2014-02-26",
"location": "[parameters('projectSettings').accountLocation]",
"properties": {
"ProcessTemplateId": "[parameters('projectSettings').processTemplateId]",
"VersionControlOption": "[parameters('projectSettings').versionControlOption]",
"ownerUpn": "[parameters('projectSettings').ownerUpn]",
"PipelineBootstrapConfigurations": [
{
"name": "[parameters('projectSettings').projectName]",
"templateId": "ms.vss-continuous-delivery-pipeline-templates.aspnetcore-windowswebapp-byoc",
"templateParameters": {
"subscriptionId": "862fc568--4e94-9c80-a0a647**",
"resourceGroup": "devops-byoc-rg",
"webAppName": " devops-byoc",
"location": "East US",
"appServicePlan": "S1 Standard",
"appInsightLocation": "South Central US",
"azureAuth": "[parameters('azureAuth')]"
},
"repository": {
"repositoryType": "Git",
"id": "https://portal-@dev.azure.com//Portal/_git/arm",
"defaultBranch": "master",
"authorization": {
"authorizationType": "basic",
"parameters": {
"userName": "
***",
"userPassword": "*******"
}
}
}
}
]
},
"dependsOn": [
"[concat('microsoft.visualstudio/account/', parameters('projectSettings').accountName)]"
]
}
]
}
]
}

Unable to deploy azure nodejs functions with nested directory structure using Azure pipeline

Hello,

I am trying to deploy Azure Functions with a nested directory structure using Azure Pipeline, but it's not working. When I place the function directories in the root directory, it works fine, but when I place the function in a nested directory, it's not working. I have followed the instructions in the documentation mentioned below, but it's not working:

https://learn.microsoft.com/en-us/azure/azure-functions/functions-how-to-azure-devops?tabs=nodejs%2Cyaml%2Cjavascript

Here's an example of the directory structure I'm using:
├── host.json
├── nested
│ ├── foo
│ │ ├── function.json
│ │ └── index.js
│ ├── bar
│ │ ├── function.json
│ │ └── index.js
│ └── baz
│ ├── function.json
│ └── index.js
├── package.json
└── README.md

Here's my azurepipeline.yaml file:

`pool:
name: Azure Pipelines
steps:

  • task: NodeTool@0
    displayName: 'Use Node version'
    inputs:
    versionSpec: 18.x

  • task: Npm@1
    displayName: 'Install Application Dependencies'
    inputs:
    workingDir: '$(System.DefaultWorkingDirectory)'
    verbose: false

  • task: Npm@1
    displayName: 'Run ''build'' script'
    inputs:
    command: custom
    workingDir: '$(System.DefaultWorkingDirectory)'
    verbose: false
    customCommand: 'run build --if-present'

  • task: Npm@1
    displayName: 'Remove extraneous packages'
    inputs:
    command: custom
    workingDir: '$(System.DefaultWorkingDirectory)'
    verbose: false
    customCommand: 'prune --production'

  • task: ArchiveFiles@2
    inputs:
    rootFolderOrFile: '$(System.DefaultWorkingDirectory)'
    includeRootFolder: false
    archiveType: 'zip'
    archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
    replaceExistingArchive: true
    displayName: 'Archive files'

  • task: PublishBuildArtifacts@1
    inputs:
    artifactName: 'drop'
    pathtoPublish: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
    displayName: 'Publish build artifacts'

  • task: DownloadBuildArtifacts@0
    inputs:
    buildType: 'current'
    downloadType: 'single'
    artifactName: 'drop'
    downloadPath: '$(System.DefaultWorkingDirectory)'
    displayName: 'Download build artifacts'

  • task: AzureFunctionApp@1
    inputs:
    azureSubscription: Pay-As-You-Go
    appType: functionApp
    appName: kljdsaglkds
    package: $(System.DefaultWorkingDirectory)/drop/$(Build.BuildId).zip
    displayName: 'Deploy to Azure Function App'`

Could you please help me with an example of how to deploy Azure Functions with a nested directory structure using Azure Pipeline? Thank you.

YAML pipeline builddefinition

First off thx for this example :-)

I have successfully deployed into my own org, but are having issues with creating a template project that uses YAML pipelines instead of old school buildDefinitions.

i have reversed engineered it by hitting "F12" in browser to see what requests are initiated when using portal, but have not been able to create an extension that initiates a repo with a yaml pipeline. Could you give some pointers on how this could be archived?

SampleFunctionalTest1 functional test failed for aspnet web application with Tests

Hi,

Iv'e tried to build and run tests for aspnet web application with Tests:
https://github.com/microsoft/devops-project-samples/tree/master/dotnet/aspnet/webappWithTests/Application

Iv'e created and used simple build pipeline in Azure DevOps to do so, but got exception during execution of SampleFunctionalTest1 functional test:

Error Message:
Test method SampleWebApplication.FunctionalTests.SampleFunctionalTests.SampleFunctionalTest1 threw exception:
System.NullReferenceException: Object reference not set to an instance of an object.
Stack Trace:
at SampleWebApplication.FunctionalTests.SampleFunctionalTests.SampleFunctionalTest1() in D:\a\1\s\SampleWebApplication.FunctionalTests\SampleFunctionalTests.cs:line 39

Stack trace actually points to next line in "SampleWebApplication.FunctionalTests\SampleFunctionalTests.cs" file:
var webAppUrl = testContext.Properties["webAppUrl"].ToString();

ARM Template - DevOps Project

Hello,

I've been trying to update my ARM Template to deploy DevOps Project with the new ARM Template Reference:
https://docs.microsoft.com/en-us/azure/templates/microsoft.devops/2019-07-01-preview/pipelines

The idea is to create a new DevOps Organization, create a new project and fire up the demo pipeline.

My ARM Template looks like :

"resources": [
{
"type": "microsoft.visualstudio/account",
"name": "[parameters('accountName')]",
"apiVersion": "2014-02-26",
"location": "[parameters('location')]",
"properties": {
"operationType": "Create",
"accountName": "[parameters('accountName')]"
}
},
{
"type": "Microsoft.DevOps/pipelines",
"apiVersion": "2019-07-01-preview",
"name": "[parameters('projectName')]",
"location": "[parameters('location')]",
"properties": {
"organization": {
"name": "[parameters('accountName')]"
},
"project": {
"name": "[parameters('projectName')]"
},
"bootstrapConfiguration": {
"template": {
"id": "ms.vss-continuous-delivery-pipeline-templates.aspnetcore-webapponcontainers",
"parameters": {
"resourceGroup": "[parameters('targetResourceGroupName')]",
"appInsightLocation": "[parameters('appInsightsLocation')]",
"subscriptionId": "[variables('subscriptionId')]",
"webAppName": "projectdotnet",
"location": "[parameters('targetResourceGroupLocation')]",
"appServicePlan": "S1 Standard",
"containerRegistryName": "[variables('acrName')]",
"containerRegistrySKU": "[parameters('acrSku')]",
"containerRegistryLocation": "[parameters('acrlocation')]",
"azureAuth": "[parameters('azureAuth')]"
}
},
"repository": null
}
},
"dependsOn": [
"[concat('microsoft.visualstudio/account/', parameters('accountName'))]"
]
}
]

I'm getting an error which brings two questions:

  1. azureAuth parameter:
    The way Bishal refers to it is
    "azureAuth": {
    "value": "{"scheme":"ServicePrincipal","parameters":{"tenantid":"XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX","objectid":"XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX","serviceprincipalid":"XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX","serviceprincipalkey":"password"}}"
    }

Is it still valid? As app registration evolved, it seems that objectid is now id.
Which one is the correct writing?

  1. The error I get now is:

{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details.","details":[{"code":"NotFound","message":"{\r\n "code": "ProjectNotFoundWithId",\r\n "message": "Failed to create Azure Pipeline 'williamtestproj'. More details: 'Configuration failed at step: 'Creating assets'. More details: Invalid property identifier character: \\. Path '', line 1, position 1..'. ",\r\n "target": "GetAzurePipelineOperation"\r\n}"}]}

The DevOps org gets creates, the project gets created, but the Service Connection doesn't happen. And the pipeline doesn't create.

I thought at first it was related to the azureAuth, but I'm now confused.
I also tried to use the way Bishal was refering to it in the wiki, using the nested pipeline bootstrapconfigurations but I ended up with the same issue (except for the target name that is not the same).

any idea? that would be quite helpful!

Thanks,
William

devops-project-samples - ARM Template - DevOps Project

Hello,

I'm having a hard time using the ARM Template to create a DevOps Project using the Project Samples.

What I'm trying to do is to create an ARM Template that would have the same result as what you can do from the Azure Portal:
--> Create the DevOps Account --> Create the Project --> Bootstrap the CI/CD pipeline create the master, create the build and then the release to the production environment (Azure App,...).

Maybe I'm doing it wrong.
I have some questions regarding how to do it:

  1. Should I use the ARM template that is configuring the project with the BootstrapPipelineTemplate?
    https://github.com/Microsoft/devops-project-samples/blob/master/armtemplates/devopsproject/template.json
    or should I use the new feature pipelineBootstrapConfigurations?
    https://docs.microsoft.com/en-us/azure/templates/microsoft.visualstudio/2018-08-01-preview/account/project

  2. Do you plan to update the ARM template with the new feature?

  3. Does the ARM template from the DevOps Project take care of creating the target environment? or is it something that I would have to add up (meaning the Azure App, the AKS...)?
    I'm wondering as the ARM templates are being copied into the Azure Repos.
    Besides, by exporting some DevOps Project deployments, I get some info:

"PipelineBootstrapConfigurations": [
{
"name": "[parameters('projectSettings').projectName]",
"templateId": "ms.vss-continuous-delivery-pipeline-templates.expressjs-aks",
"templateParameters": {
"subscriptionId": "---****-***",
"clusterName": "devkubnodetest",
"location": "West Europe",
"resourceGroup": "devkubnodetest-rg",
"appInsightLocation": "West Europe",
"kubernetesVersion": "1.10.8",
"nodeCount": "3",
"nodeSize": "Standard_D2_v2",
"omsLocation": "West Europe",
"containerRegistryName": "devkubnodetestacr",
"containerRegistrySKU": "Standard",
"containerRegistryLocation": "West Europe",
"azureAuth": "[parameters('azureAuth')]"
},
"repository": null

  1. Is there a way to get more info regarding the options that could be used for :
    1. The bootstrapPipelineTemplate options
    2. The pipelineBootstrapConfigurations options

--> The DevOps Project ARM Apis are not helping out that much
https://docs.microsoft.com/en-us/azure/templates/microsoft.visualstudio/2018-08-01-preview/account/project

I'm actually wondering what would be within the "azureAuth" option from the PipelineBootstreapConfigurations.
Same for the repository if I wanted to point to the Microsoft/devops-project-samples repo.

Thank you so much for your help!

William

helm upgrade error in release pipeline - Java x Spring x AKS

The below error was happened in release pipeline (not build pipeline, build was passed).

[error]Error: invalid argument "900s" for "--timeout" flag: strconv.ParseInt: parsing "900s": invalid syntax

It seems very simple fix but I couldn't find the release pipeline definition in this repository so I can't find out how to fix by myself.

situation

  • DevOps Project choice: Java x Spring x AKS 1.15.5 (it reproduced with 1.15.7 as well)
    • I didn't check other versions for example 1.14.x, 1.13.x.

error detail

2020-02-19T11:01:13.7824445Z ##[section]Starting: Helm upgrade
2020-02-19T11:01:13.7831737Z ==============================================================================
2020-02-19T11:01:13.7831852Z Task         : Package and deploy Helm charts
2020-02-19T11:01:13.7832010Z Description  : Deploy, configure, update a Kubernetes cluster in Azure Container Service by running helm commands
2020-02-19T11:01:13.7832129Z Version      : 0.164.3
2020-02-19T11:01:13.7832251Z Author       : Microsoft Corporation
2020-02-19T11:01:13.7832346Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/helm-deploy
2020-02-19T11:01:13.7832493Z ==============================================================================
2020-02-19T11:01:15.6991427Z [command]/opt/hostedtoolcache/helm/2.16.3/x64/linux-amd64/helm upgrade --namespace devd123 --install --force --wait --set image.repository=****.azurecr.io/**** --set image.tag=159 --set applicationInsights.InstrumentationKey=**** --set imagePullSecrets={****} --timeout 900s azuredevops /home/vsts/work/r1/a/Drop/drop/sampleapp-v0.2.0.tgz
2020-02-19T11:01:15.7666863Z Error: invalid argument "900s" for "--timeout" flag: strconv.ParseInt: parsing "900s": invalid syntax
2020-02-19T11:01:15.7777325Z ##[error]Error: invalid argument "900s" for "--timeout" flag: strconv.ParseInt: parsing "900s": invalid syntax

2020-02-19T11:01:15.7789358Z ##[section]Finishing: Helm upgrade

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.