Skip to content

dt-demos/azure-devops-extension-dt-push-event

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

This repo contains the soure code and instructions for buulding your an Azure DevOps extention allows you to integrate Deployment Events into your release pipelines. See the Extension README for an overview of usage and features.

For an overview of the process to develop extensions, read this Microsoft guide and this blog series.

You can reach out to rob.jahn@dynatrace.com with questions.

Build and publish using copy of this extension

NOTE: The instructions and helper scripts assume MacOS.

Prerequisites

  1. Create or have access to add extensions to a Azure DevOps account

  2. Create Azure Marketplace publisher account - See this Microsoft guide for help

Development environment

  1. Install Node

  2. Install an IDE. I use Visual Studio Code

Project setup

  1. Copy this repo so that you can adjust for your needs. The file structure is as follows:
  • pushEvent/v[x] contains the extension source by major version
  • pushEvent/v[x]/tests Mock unit tests that use the 'azure-pipelines-task-lib/mock-test' module
  • scripts/ bash scripts used to compile, test and publish the extension
  • scripts/extension-packages where the compiled extension archive files are placed
  • scripts/json-backup backup of the JSON files that are updated by the publishing script

NOTE: These commands have already been done and the resulting files are already in this repo, but for your reference these were commands used during project creation as taken from the Microsoft guide

npm install azure-pipelines-task-lib --save
npm install @types/node --save-dev
npm install @types/q --save-dev
npm install --save requests
npm install -g typescript
npm install -g tfx-cli
tsc --init
  1. Edit pushEvent/vss-extension.json and pushEvent/src/v[x]/task.jsonfiles with your values for id, name, publisher, and other attributes as needed.

  2. Adjust the pushEvent/icon.png for the extension icon. This need to be 128x128 pixels.

  3. Adjust the pushEvent/src/v[x]/icon.png for the task icon. This need to be 128x128 pixels.

  4. Replace the ID value in pushEvent/src/v[x]/task.json. Use the GUID generator to get an unique value

Development and testing

This assumes you have a Dynatrace tenant and some monitored application that has tags. Below are instructions for editing the input files with this information.

The pushEvent/src/v[x]/tests/_suite.ts test suite file defines the tests that will send events the defined Dynatrace enviromment. To make the test work, follows these steps:

  1. Copy the test inputs template and adjust the values for your Dynatrace environment

    cd pushEvent/src/v[x]/tests/input-files
    cp test-inputs.json.template test-inputs.json
    # edit test-inputs.json with your Dynatrace URL and API Token values
    
  2. Edit the pushEvent/src/v[x]/tests/input-files/tagRule.txt file as to match some Dynatrace monitored service.

  3. Optionally, edit the pushEvent/src/v[x]/tests/input-files/customProperties.txt for testing.

  4. Review and use the provided script to compile and run the mocha test suite.

    cd scripts
    ./compile.sh
    

Publication setup

Each extention needs a unique version and needs to be a "vsix" archive file that is uploaded to the Microsoft Marketplace. The scripts/publish.sh script is provided to update the json files, compile the extension and publish it.

  1. Create a DevOps personal access token. See this Microsoft guide.

  2. First copy the publish inputs template and adjust the values for your Extension. (Version, Publisher, Personal Access token, Extension Name)

    # cd into the root project folder
    cp publish-inputs.sh.template publish-inputs.sh
    # edit publish-inputs.sh
    
  3. Run the publish script

    cd scripts
    ./publish.sh
    

    ** NOTE: The publish shell script assumes three publishers for DEV, TEST, and PROD where DEV and TEST are private and PROD is public. So, adjust the script and variables to meet you needs.**

  4. Verify the published extension in the Marketplace. It should look something like this

Versioning

  1. The conversion is Major.Minor.Patch and there are two versions in this project.

    • vss-extension.json this is overall extension version and needs to be updated every new publish
      • the tfx extension publish --rev-version flag updates the patch number in the files automatically
      • manually adjust if want to update 'Major' or 'Minor' version number and change the 'Patch' number back to zero.
    • task.json this is the task level version that shows up in Azure DevOps pipeline page
      • manually adjust the 'Minor' and 'Patch' number for changes
  2. For a change to the task 'Major' version

    • copy the /src/v[x]/ folder to the next version
    • revert the version number to x.0.0
    • once published, the task version drop down in Azure DevOps shows 1.*, 2.*, etc.

    This will allow you to update version of the Major task releases independantly. Read this for for more info

  3. Any version updates to an extension will automatically install the new version to the Azure DevOps orgs where it is installed. It make take a minute or two to propogate.

  4. Adding this attribute to the task.json file will be marked in Azure DevOps as DEPRECATED.

    "deprecated": true,
    
  5. for a 'private' publisher, you can delete and extension but will be deleted from any pipeline it is installed in and break the pipeline.

  6. for a 'public' published, you must contact MS support to delete. One can 'unpublish' the extension but it is still viewable in the market place. Once can use the 'deprecated' flag as another option.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published