WARN unable to find package.json for plottable - azure

When running a build for storybook via an Azure devops pipeline I get the above mentioned error.
I've tried to completely remove this package(plottable) from my project but I keep getting this error and it causes my webpack build to get stuck.
This error doesn't occur locally.
My pipeline:
trigger:
batch: true
branches:
include:
- master
stages:
- stage: develop_build_deploy_stage
pool:
name: Default
demands:
- msbuild
- visualstudio
jobs:
- job: develop_build_deploy_job
steps:
- checkout: self
clean: true
persistCredentials: true
- task: NodeTool#0
displayName: Install Node
inputs:
versionSpec: '12.x'
- task: PowerShell#2
displayName: 'Install Dependencies'
inputs:
targetType: 'inline'
script: |
npm install
- task: PowerShell#2
displayName: 'Increment version'
inputs:
targetType: 'inline'
script: |
git checkout master
git pull origin master
git config --global user.email "d#gmail.com"
git config --global user.name "Build Agent"
npm version patch -m "Increment Version [skip ci]" --force
git push
- task: PowerShell#2
displayName: 'Build Project'
inputs:
targetType: 'inline'
script: |
npm run build-storybook
npm run build
- task: CopyFiles#2
displayName: 'Copy storybook-static Files'
inputs:
sourceFolder: '$(Build.SourcesDirectory)/storybook-static'
contents: '**'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts#1
displayName: 'Publish storybook-static Files to ArtifactStagingDirectory'
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: Storybook
- task: S3Upload#1
displayName: 'Upload storybook-static to S3'
inputs:
awsCredentials: 'my-s3'
regionName: 'us-east-1'
bucketName: 'my-s3-bucket'
sourceFolder: $(Build.ArtifactStagingDirectory)
- task: Npm#1
displayName: 'Publish to Feed'
inputs:
command: 'publish'
publishRegistry: 'useFeed'
publishFeed: '#####'
How would I go about resolving this problem?

I still don't know what caused this to be the case but for some reason the changes I had made on my branch weren't being picked up and an import that I had removed wasn't removed on the branch that was being built on.
So in the end it was trying to import a package which I had removed as a dependency.

Related

How to get an Azure pipeline for Go to work

The default .yaml file provided by the ADO pipeline fails. There's been an issue open for over a year on it and the problem still exists.
I tried this .yaml file from learn.microsoft but it fails with the error below. Does someone have a .yaml file that works for a Go pipeline in Azure DevOps?
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
steps:
- task: GoTool#0
inputs:
version: '1.13.5'
- task: Go#0
inputs:
command: 'get'
arguments: '-d'
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: Go#0
inputs:
command: 'build'
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: CopyFiles#2
inputs:
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts#1
inputs:
artifactName: drop
Here's the error:
##[section]Starting: Go
==============================================================================
Task : Go
Description : Get, build, or test a Go application, or run a custom Go command
Version : 0.210.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/go
==============================================================================
[command]/opt/hostedtoolcache/go/1.13.5/x64/bin/go get -d
go get .: path /home/vsts/work/1/s is not a package in module rooted at /home/vsts/work/1/s
##[error]The Go task failed with an error: Error: The process '/opt/hostedtoolcache/go/1.13.5/x64/bin/go' failed with exit code 1
##[section]Finishing: Go
Just try this :
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
steps:
- task: GoTool#0
inputs:
version: '1.13.5'
- task: Go#0
inputs:
command: 'get'
arguments: '-v all'
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: Go#0
inputs:
command: 'build'
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: CopyFiles#2
inputs:
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts#1
inputs:
artifactName: drop

How to use pnpm on Azure Pipelines?

In my Nextjs project, I want to create a pipeline using Azure Pipelines. But my project uses pnpm package manager. I have read pnpm doc that only Travis, Semaphore, AppVeyor, GitHub Actions, Gitlab CI, and Bitbucket Pipelines. No Azure Pipelines documentation.
Does anyone know how to implement this?
I have created my own recipe for my pipelines in Azure pipelines.
Any feedback will be useful
For Nextjs
azure-pipelines.yml
variables:
pnpm_config_cache: $(Pipeline.Workspace)/.pnpm-store
trigger:
- main
pool:
vmImage: ubuntu-latest
steps:
- task: Cache#2
inputs:
key: 'pnpm | "$(Agent.OS)" | pnpm-lock.yaml'
path: $(pnpm_config_cache)
displayName: Cache pnpm
- task: Cache#2
inputs:
key: next | $(Agent.OS) | pnpm-lock.yaml
path: "$(System.DefaultWorkingDirectory)/.next/cache"
displayName: "Cache .next/cache"
- script: |
curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm#7
pnpm config set store-dir $(pnpm_config_cache)
displayName: "Setup pnpm"
- script: |
pnpm install
pnpm run build
displayName: "pnpm install and build"
- task: ArchiveFiles#2
inputs:
rootFolderOrFile: "."
includeRootFolder: false
archiveType: "zip"
archiveFile: "$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip"
replaceExistingArchive: true
- task: PublishBuildArtifacts#1
inputs:
PathtoPublish: "$(Build.ArtifactStagingDirectory)"
ArtifactName: "drop"
publishLocation: "Container"
For other build (removed version of Nextjs part)
azure-pipelines.yml
variables:
pnpm_config_cache: $(Pipeline.Workspace)/.pnpm-store
trigger:
- main
pool:
vmImage: ubuntu-latest
steps:
- task: Cache#2
inputs:
key: 'pnpm | "$(Agent.OS)" | pnpm-lock.yaml'
path: $(pnpm_config_cache)
displayName: Cache pnpm
- script: |
curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm#7
pnpm config set store-dir $(pnpm_config_cache)
displayName: "Setup pnpm"
- script: |
pnpm install
pnpm run build
displayName: "pnpm install and build"
- task: ArchiveFiles#2
inputs:
rootFolderOrFile: "."
includeRootFolder: false
archiveType: "zip"
archiveFile: "$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip"
replaceExistingArchive: true
- task: PublishBuildArtifacts#1
inputs:
PathtoPublish: "$(Build.ArtifactStagingDirectory)"
ArtifactName: "drop"
publishLocation: "Container"

Azure DevOps Failed to update App Service configuration details

I am trying to deploy a WebApp in Azure DevOps and I am getting this error:
[warning]Failed to update App Service configuration details. Error: Error: Failed to update App service 'webapp' configuration. Error: BadRequest - Required parameter AccessKey is missing.
I can't figure out why this is happening, it was working originally and the error came about the other day. Nothing has changed with the WebApp code, no new settings were added. The artifact goes into place and the website works but I get this error, then on another run, the pipeline will fail, so I only have one successful run, then I have to go and delete the web app to have another successful run.
Here is my YAML Code:
trigger:
branches:
include:
- master
pr: none
pool:
vmImage: windows-latest
resources:
repositories:
- repository: Website
name: VALUE/Website
path:
- include: /Website
type: git
ref: VALUE
variables:
System.Debug: false
azureSubscription: VALUE
RG: rg_example
Location: UK South
containername: private
appconnectionname: VALUE
stages:
- stage: build_website_files
displayName: Building Main Website Files
jobs:
- job: job1
displayName: Create And Publish Artifact
steps:
- checkout: Website
- task: CmdLine#2
inputs:
script: 'mkdir Website'
workingDirectory: $(Build.ArtifactStagingDirectory)
- task: CmdLine#2
inputs:
script: 'echo $(Build.ArtifactStagingDirectory)/Website'
- task: DotNetCoreCLI#2
displayName: dotnet restore
inputs:
command: restore
projects: Website.csproj
- task: NodeTool#0
displayName: Install Node .js
inputs:
versionSpec: 14.17.3
force32bit: false
checkLatest: false
- script: |
npm install -g #angular/cli#12.1.3
npm install
ng build --prod
displayName: npm install and build
- task: DotNetCoreCLI#2
displayName: dotnet build
inputs:
projects: Website.csproj
arguments: '--configuration Release'
- task: DotNetCoreCLI#2
displayName: dotnet restore unit tests
inputs:
command: restore
projects: UnitTests/UnitTests.csproj
- task: DotNetCoreCLI#2
displayName: dotnet Test
inputs:
command: test
projects: UnitTests/UnitTests.csproj
arguments: '--configuration Release'
- task: DotNetCoreCLI#2
displayName: dotnet publish
inputs:
command: publish
projects: Website.csproj
arguments: --configuration Release --output $(Build.ArtifactStagingDirectory)/Website
zipAfterPublish: true
modifyOutputPath: false
- task: PublishPipelineArtifact#1
displayName: Publish Pipeline Artifact
inputs:
targetPath: $(Build.ArtifactStagingDirectory)/Website
artifact: Website
publishLocation: pipeline
- stage: put_website_files_into_place
displayName: website_files_into_place
dependsOn: build_website_files
jobs:
- job: job2
displayName: Create Web App
#dependsOn: job1
steps:
- download: none
- task: DownloadPipelineArtifact#2
displayName: Download Build Artifacts
inputs:
patterns: '**/*.zip'
path: $(Build.ArtifactStagingDirectory)/Website/
- task: AzureWebApp#1
displayName: 'Azure Web App Deploy: value'
inputs:
package: $(Build.ArtifactStagingDirectory)/**/*.zip
azureSubscription: $(azureSubscription)
ConnectedServiceName: $(appconnectionname)
appName: value
ResourceGroupName: $(RG)

Is it possible to copy build artifact from pipeline into repo

I'm trying to copy my published zip build into my azure repo for easy access. I have the following YML code. See inline comment with my question:
- task: ArchiveFiles#2
inputs:
rootFolderOrFile: '$(build.artifactstagingdirectory)\MyFolder'
includeRootFolder: true
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)\zipfolder/$(Build.BuildId).zip'
replaceExistingArchive: true
- task: PublishBuildArtifacts#1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)\zipfolder'
TargetPath: '$(Build.SourcesDirectory)\MyFolder' // Here I would expect the code to copy the zip into my repo.
You could download the artifact and use the git command in command line task to push it to the repo, refer to the sample as below, it works for me.
# 'Allow scripts to access the OAuth token' was selected in pipeline. Add the following YAML to any steps requiring access:
# env:
# MY_ACCESS_TOKEN: $(System.AccessToken)
# Variable Group 'vargroup1' was defined in the Variables tab
resources:
repositories:
- repository: self
type: git
ref: refs/heads/testb2
jobs:
- job: Job_1
displayName: Agent job 1
pool:
vmImage: ubuntu-20.04
steps:
- checkout: self
persistCredentials: True
- task: ArchiveFiles#2
displayName: Archive README.md
inputs:
rootFolderOrFile: README.md
archiveFile: $(Build.ArtifactStagingDirectory)\zipfolder/$(Build.BuildId).zip
- task: PublishBuildArtifacts#1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: $(Build.ArtifactStagingDirectory)\zipfolder
- task: DownloadBuildArtifacts#1
displayName: Download Build Artifacts
inputs:
artifactName: drop
- task: CmdLine#2
displayName: Command Line Script
inputs:
script: >-
cd $(System.ArtifactsDirectory)\zipfolder
git config --global user.email "xxxxx"
git config --global user.name "xxxxx"
git init
git add .
git commit -m "123"
git remote add origin https://$(System.AccessToken)#dev.azure.com/orgname/testpro1/_git/testpro4
git push https://$(System.AccessToken)#dev.azure.com/orgname/testpro1/_git/testpro4
...
The alternative is to push to repo and then sync from the remote git/ - basically a automated way of pulling the file over.

CI-CD Azure devops for function app deployment

My Function app Name:
my_func_dev_app
Functions I have in my project
func_dev
func_prd
Push func_dev to my_func_dev_app
Push func_prd to my_func_prd_app
But It is pushing both func_dev and func_prd to my_func_de_app
My app folder structure
(folder)myapp_function
(folder)func_dev --__init__.py
-- function.json
(folder)func_prd --__init__.py
-- function.json
task.py
Multi stage Pipeline:
#pipelines1
trigger:
- '*'
stages:
- stage: 'Build'
displayName: 'Build the web application'
jobs:
- job: 'Build'
displayName: 'Build job'
pool:
name: 'onprem_agent'
steps:
- task: CopyFiles#2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
Contents: |
**/*
!.git/**
OverWrite: true
CleanTargetFolder: true
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: ArchiveFiles#2
displayName: "Archive files"
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/myapp_function'
includeRootFolder: false
archiveFile: '$(Build.ArtifactStagingDirectory)/build$(Build.BuildId).zip'
- task: PublishBuildArtifacts#1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'myapp_function'
- stage: 'DEV_AZURE'
displayName: 'Az DEV Deploy'
dependsOn: Build
condition: |
and
(
succeeded(),
eq(variables['Build.SourceBranchName'], variables['releaseBranchName'])
)
jobs:
- deployment: Deploy
environment: dev
variables:
- group: Release
strategy:
runOnce:
deploy:
steps:
- download: current
artifact: myapp_function
displayName: Downloading artifacts
- task: AzureFunctionApp#1
inputs:
azureSubscription: CI-CD
appType: functionAppLinux
appName: my_func_dev_app
package: '$(Pipeline.Workspace)/myapp_function/*.zip'
deployToSlotOrASE: true
resourceGroupName: my-rg
slotName: PRODUCTION
displayName: 'Deploying dev'
How to fix? Push func_dev to my_func_dev_app and ignore func_prd
How to fix? Push func_dev to my_func_dev_app and ignore func_prd
To solve this issue, you can package your two projects separately into zip.
In your ArchiveFiles task, you need to specify a specific project.
For example:
For func_dev project: $(Build.ArtifactStagingDirectory)/myapp_function/func_dev
- task: ArchiveFiles#2
displayName: "Archive files"
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/myapp_function/func_dev'
includeRootFolder: false
archiveFile: '$(Build.ArtifactStagingDirectory)/build$(Build.BuildId)-func_dev.zip'
Then you can only package the project corresponding to the function app name.
If you want to deploy two projects to the corresponding function app in one pipeline at the same time, you could use the same method to separately package the two projects as zip.

Resources