{"_id":"@antoniobergas/scaffolder-backend-module-azure-pipelines","name":"@antoniobergas/scaffolder-backend-module-azure-pipelines","dist-tags":{"latest":"2.0.0"},"versions":{"2.0.0":{"name":"@antoniobergas/scaffolder-backend-module-azure-pipelines","version":"2.0.0","description":"A collection of Backstage scaffolder backend modules for Azure pipelines.","main":"dist/index.cjs.js","types":"dist/index.d.ts","publishConfig":{"access":"public","main":"dist/index.cjs.js","types":"dist/index.d.ts"},"backstage":{"role":"backend-plugin-module"},"scripts":{"start":"backstage-cli package start","build":"backstage-cli package build","lint":"backstage-cli package lint","test":"backstage-cli package test","clean":"backstage-cli package clean","prepack":"backstage-cli package prepack","postpack":"backstage-cli package postpack","update":"backstage-cli versions:bump"},"repository":{"type":"git","url":"git+https://github.com/antoniobergas/scaffolder-backend-module-azure-pipelines.git"},"keywords":["backstage","azure-devops","azure-pipelines","backstage-plugin","backstage-template"],"author":{"name":"Parfümerie Douglas GmbH"},"license":"Apache-2.0","bugs":{"url":"https://github.com/antoniobergas/scaffolder-backend-module-azure-pipelines/issues"},"homepage":"https://github.com/antoniobergas/scaffolder-backend-module-azure-pipelines#readme","dependencies":{"@backstage/backend-common":"^0.19.7","@backstage/errors":"^1.2.2","@backstage/integration":"^1.7.0","@backstage/plugin-scaffolder-backend":"^1.17.3","@backstage/plugin-scaffolder-node":"^0.2.5","@backstage/types":"^1.1.1","node-fetch":"^2.6.2"},"devDependencies":{"@backstage/cli":"^0.22.13","@types/node-fetch":"^2.6.2"},"dependenciesMeta":{"buildcheck@0.0.4":{"unpluggined":true}},"gitHead":"7cb82e929e920901df6648bc8b6a39a821371782","_id":"@antoniobergas/scaffolder-backend-module-azure-pipelines@2.0.0","_nodeVersion":"16.20.2","_npmVersion":"8.19.4","dist":{"integrity":"sha512-JG5WqJz9Xb9GG2/Kfw+Zao1zS3RblU4ZvUFg2ohfz9Q4RZ1tH8fi2dp552VMrivHLMMWzs8SrNDmp4p9yRdwXA==","shasum":"48a26f99c6232da231ce2965b70f2cd842f8cd33","tarball":"https://registry.npmjs.org/@antoniobergas/scaffolder-backend-module-azure-pipelines/-/scaffolder-backend-module-azure-pipelines-2.0.0.tgz","fileCount":6,"unpackedSize":73563,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCfGvTJktdMN7/m2nDWCqT4LZczWr/OSl8DunR5A196uQIgFhgETk3oRB5felENYoo75pyKszVIRlyfyTQe8PHT9YU="}]},"_npmUser":{"name":"antoniobergas","email":"anthonyprincedom@hotmail.com"},"directories":{},"maintainers":[{"name":"antoniobergas","email":"anthonyprincedom@hotmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/scaffolder-backend-module-azure-pipelines_2.0.0_1697220966047_0.5398309109659196"},"_hasShrinkwrap":false}},"time":{"created":"2023-10-13T18:16:05.929Z","2.0.0":"2023-10-13T18:16:06.390Z","modified":"2023-10-13T18:16:06.923Z"},"maintainers":[{"name":"antoniobergas","email":"anthonyprincedom@hotmail.com"}],"description":"A collection of Backstage scaffolder backend modules for Azure pipelines.","homepage":"https://github.com/antoniobergas/scaffolder-backend-module-azure-pipelines#readme","keywords":["backstage","azure-devops","azure-pipelines","backstage-plugin","backstage-template"],"repository":{"type":"git","url":"git+https://github.com/antoniobergas/scaffolder-backend-module-azure-pipelines.git"},"author":{"name":"Parfümerie Douglas GmbH"},"bugs":{"url":"https://github.com/antoniobergas/scaffolder-backend-module-azure-pipelines/issues"},"license":"Apache-2.0","readme":"# scaffolder-backend-module-azure-pipelines\n\nWelcome to the Microsoft Azure pipeline actions for the `scaffolder-backend`.\n\nThis plugin contains a collection of actions:\n\n- `azure:pipeline:create`\n- `azure:pipeline:run`\n- `azure:pipeline:permit`\n\nIt utilizes Azure DevOps REST APIs to\n[create](https://docs.microsoft.com/en-us/rest/api/azure/devops/pipelines/pipelines/create?view=azure-devops-rest-6.1),\n[run](https://docs.microsoft.com/en-us/rest/api/azure/devops/pipelines/runs/run-pipeline?view=azure-devops-rest-6.1),\nand\n[authorize](https://docs.microsoft.com/en-us/rest/api/azure/devops/approvalsandchecks/pipeline-permissions/update-pipeline-permisions-for-resource?view=azure-devops-rest-7.1)\nAzure pipelines.\n\n## Getting started\n\nCreate your Backstage application using the Backstage CLI as described here:\n<https://backstage.io/docs/getting-started/create-an-app>.\n\n> Note: If you are using this plugin in a Backstage monorepo that contains the\n> code for `@backstage/plugin-scaffolder-backend`, you need to modify your\n> internal build processes to transpile files from the `node_modules` folder as\n> well.\n\nYou need to configure the actions in your backend:\n\n## From your Backstage root directory\n\n```sh\n# From your Backstage root directory\nyarn add --cwd packages/backend @antoniobergas/scaffolder-backend-module-azure-pipelines\n```\n\nConfigure the actions (you can check the\n[docs](https://backstage.io/docs/features/software-templates/writing-custom-actions#registering-custom-actions)\nto see all options):\n\n```typescript\n// packages/backend/src/plugins/scaffolder.ts\n\nimport {\n  createAzurePipelineAction,\n  permitAzurePipelineAction,\n  runAzurePipelineAction,\n} from \"@parfuemerie-douglas/scaffolder-backend-module-azure-pipelines\";\n\nconst actions = [\n  createAzurePipelineAction({ integrations }),\n  permitAzurePipelineAction({ integrations }),\n  runAzurePipelineAction({ integrations }),\n  ...createBuiltInActions({\n    containerRunner,\n    catalogClient,\n    integrations,\n    config: env.config,\n    reader: env.reader,\n  }),\n];\n\nreturn await createRouter({\n  containerRunner,\n  catalogClient,\n  actions,\n  logger: env.logger,\n  config: env.config,\n  database: env.database,\n  reader: env.reader,\n});\n```\n\nThe Azure pipeline actions use an [Azure PAT (personal access\ntoken)](https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate)\nfor authorization. The PAT requires `Read & execute` permission for `Build` for\nthe `azure:pipeline:create` and `azure:pipeline:run` actions. For the\n`azure:pipeline:permit` action the PAT requires `Read, query, & manage`\npermission for `Service Connections`. Simply add the PAT to your\n`app-config.yaml`:\n\n```yaml\n# app-config.yaml\n\nintegrations:\n  azure:\n    - host: dev.azure.com\n      credentials:\n        - personalAccessToken: ${AZURE_TOKEN}\n```\n\nRead more on integrations in Backstage in the [Integrations\ndocumentation](https://backstage.io/docs/integrations/).\n\n## Using the template\n\nAfter loading and configuring the Azure pipeline template actions, you can use\nthe actions in your template:\n\n```yaml\n# template.yaml\n\napiVersion: scaffolder.backstage.io/v1beta3\nkind: Template\nmetadata:\n  name: create-azure-pipeline-demo\n  title: Create Azure Pipeline Test\n  description: Create Azure pipeline example\nspec:\n  owner: parfuemerie-douglas\n  type: service\n\n  parameters:\n    - title: Fill in some steps\n      required:\n        - name\n        - owner\n      properties:\n        name:\n          title: Project name\n          type: string\n          description: Choose a unique project name.\n          ui:field: EntityNamePicker\n          ui:autofocus: true\n        owner:\n          title: Owner\n          type: string\n          description: Select an owner for the Backstage component.\n          ui:field: OwnerPicker\n          ui:options:\n            allowedKinds:\n              - Group\n    - title: Choose a location\n      description: >-\n        Organization is an Azure DevOps organization. Owner is an Azure DevOps project.\n        Repository is the name of the repository Backstage will create for you.\n      required:\n        - repoUrl\n      properties:\n        repoUrl:\n          title: Repository Location\n          type: string\n          ui:field: RepoUrlPicker\n          ui:options:\n            allowedHosts:\n              - dev.azure.com\n    - title: Choose Pipeline Parameters\n      description: Please select some pipeline parameters\n      properties:\n        pipelineParameters:\n          title: Pipeline Parameters\n          type: object\n          properties:\n            name:\n              type: string\n            id:\n              type: number\n            foo:\n              type: string\n***note these properties for parameters are just examples, you can use whatever key values that your pipeline will accept! (note if the pipeline doesnt have these parameters configured it will return a 400 error\"\n\n  steps:\n    - id: fetch\n      name: Template Skeleton\n      action: fetch:template\n      input:\n        url: ./skeleton\n        values:\n          name: ${{ parameters.name }}\n          destination: ${{ parameters.repoUrl | parseRepoUrl }}\n          owner: ${{ parameters.owner }}\n\n    - id: publish\n      name: Publish\n      action: publish:azure\n      input:\n        allowedHosts: [\"dev.azure.com\"]\n        description: This is ${{ parameters.name }}\n        repoUrl: ${{ parameters.repoUrl }}\n\n    - id: createAzurePipeline\n      name: Create Azure Pipeline\n      action: azure:pipeline:create\n      input:\n        organization: ${{ (parameters.repoUrl | parseRepoUrl)['organization'] }}\n        project: ${{ (parameters.repoUrl | parseRepoUrl)['owner'] }}\n        folder: \"my-azure-pipelines-folder\"\n        name: ${{ parameters.name }}\n        repositoryId: ${{ steps.publish.output.repositoryId }}\n        repositoryName: ${{ (parameters.repoUrl | parseRepoUrl)['repo'] }}\n        yamlPath: <optional value to your azure pipelines yaml file, defaults to ./azure-pipelines.yaml>\n\n    - id: runAzurePipeline\n      name: Run Azure Pipeline\n      action: azure:pipeline:run\n      input:\n        organization: ${{ (parameters.repoUrl | parseRepoUrl)['organization'] }}\n        pipelineId: ${{ steps.createAzurePipeline.output.pipelineId }}\n        project: ${{ (parameters.repoUrl | parseRepoUrl)['owner'] }}\n\n    - id: permitAzurePipeline\n      name: Change Azure Pipeline Permissions\n      action: azure:pipeline:permit\n      input:\n        organization: ${{ (parameters.repoUrl | parseRepoUrl)['organization'] }}\n        project: ${{ (parameters.repoUrl | parseRepoUrl)['owner'] }}\n        resourceId: <serviceEndpointId>\n        resourceType: endpoint\n        authorized: true\n        pipelineId: ${{ steps.createAzurePipeline.output.pipelineId }}\n\n    - id: register\n      name: Register\n      action: catalog:register\n      input:\n        repoContentsUrl: ${{ steps.publish.output.repoContentsUrl }}\n        catalogInfoPath: \"/catalog-info.yaml\"\n\n  output:\n    links:\n      - title: Repository\n        url: ${{ steps.publish.output.remoteUrl }}\n      - title: Pipeline\n        url: ${{ steps.createAzurePipeline.output.pipelineUrl }}\n      - title: Open in catalog\n        icon: catalog\n        entityRef: ${{ steps.register.output.entityRef }}\n```\n\n**_Note_**: The `azure:pipeline:permit` action authorizes/unauthorizes a\npipeline for a given resource. To authorize a pipeline for a [service\nendpoint](https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-service-endpoints-overview)\nset `resourceType` to `endpoint`, provide `resourceId` with the service endpoint\nID (replace `<serviceEndpointId>` in the example code above), and set authorized\nto `true`.\n\nYou can find a list of all registred actions including their parameters at the\n`/create/actions` route in your Backstage application.\n\n## API version compatibility\n\n- Create Pipeline API: \n  - 6.0-preview.1\n  - 7.0\n  - 7.1\n\n- Run Pipeline API:\n  - 6.0-preview.1\n  - 7.0\n  - 7.1\n\n- Builds API:\n  - 6.0\n  - 7.0\n  - 7.1-preview.1\n\n- Permits Pipeline API:\n  - 7.0-preview.1\n  - 7.1-preview.1\n","readmeFilename":"README.md"}