Giter Club home page Giter Club logo

azuredevops-chef-extension's People

Contributors

dependabot[bot] avatar russellseymour avatar tas50 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

azuredevops-chef-extension's Issues

Live streaming of execute log output

It would be awesome if the execute task streamed the log output, rather than waiting until task exit.

For long running tasks, such as kitchen test the lack of log output for X minutes until it exits is less than ideal for following along and might be confusing/disconcerting to users expecting to see log output.

When running kitchen from the execute task there is an unhandled error

When running kitchen the following error is generated

==============================================================================
Task         : Execute Chef Component - PREVIEW
Description  : This task allows the execution of any Chef component
Version      : 2.4.137
Author       : Chef
Help         : [More Information](https://chef-partners.github.io/azuredevops-chef-extension/execute-task.html
==============================================================================
Running as root: false
Using sudo: false
(node:2751) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'parameters' of undefined

Unable to run chef tasks with new Chef extension

Hello Team,
After installing New Chef extension to ADO project. I am unable to run chef related tasks. Can someone share examples on how to use tasks to upload cookbook to chef server and chef supermarket.?

Private BuildAgent OS: Redhat 7
Chef extension Version: 3.0.37

Please see the errors encountered while running the chef tasks.

YAML Code

    - task: ChefKnife@1
      displayName: 'upload cookbook'
      inputs:
        component: 'knife'
        arguments: 'cookbook upload $(Build.Repository.Name)'
        workingdir: '$(Agent.WorkFolder)/cookbooks/$(Build.Repository.Name)'

Errot while running the Job

Starting: upload cookbook
==============================================================================
Task         : Chef Knife
Description  : Run scripts with Knife commands on your Chef workstation
Version      : 1.0.21
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/chef-knife
==============================================================================
##[error]The current operating system is not capable of running this task. That typically means the task was written for Windows only. For example, written for Windows Desktop PowerShell.
Finishing: upload cookbook

I have tried this as well. But the job is saying that no task found with that name.

    - task: chef-software.chef-preview.execute.component-preview@2
      displayName: 'Cookstyle'
      inputs:
        component: 'chef'
        arguments: 'exec cookstyle'
A task is missing. The pipeline references a task called 'chef-software.chef-preview.execute.component-preview'. This usually indicates the task isn't installed, and you may be able to install it from the Marketplace: https://marketplace.visualstudio.com. (Task version 2, job 'Build', step ''.)

Avoid confusion with older extension

The current Chef extension for Azure Devops is version 2. It is also only for executing chef-client and interacting with the Chef server.

This new extension encompases all of the chef components so that they can be run in a pipeline.

The existing extensions from Chef are called

  • Chef Integration
  • Habitat Integration

The new combined task will be called "Chef" for simplicity sake. So as to further avoid confusion it will also be version 3.

@davymcaleer
@gsreynolds

Execute Chef Component task with non-zero exit code does not fail

A failing Cookstyle, ChefSpec or Test Kitchen run returning a non-zero exit code does not fail the Execute Chef Component task.

With cookstyle offences, failing ChefSpecs and Test Kitchen runs that fail, the following will all pass as successful/green currently:

    - task: chef-software.chef-preview.execute.component-preview@2
      displayName: 'Cookstyle'
      inputs:
        component: 'chef'
        arguments: 'exec cookstyle'
    - task: chef-software.chef-preview.execute.component-preview@2
      displayName: 'ChefSpec'
      inputs:
        component: 'chef'
        arguments: 'exec rspec'
    - task: chef-software.chef-preview.execute.component-preview@2
      displayName: Test Kitchen - test
      inputs:
        component: kitchen
        arguments: test
        envvars: |
          KITCHEN_YAML="kitchen.yml"
        workingdir: $(Build.SourcesDirectory)

Execute log output appears doubled

Starting: Cookstyle
==============================================================================
Task         : Execute Chef Component - PREVIEW
Description  : This task allows the execution of any Chef component
Version      : 2.4.152
Author       : Chef
Help         : [More Information](https://chef-partners.github.io/azuredevops-chef-extension/execute-task.html
==============================================================================
Running as root: false
Using sudo: false
/opt/chef-workstation/bin/chef exec cookstyle
Inspecting 6 files
......

6 files inspected, no offenses detected
Inspecting 6 files
......

6 files inspected, no offenses detected

Finishing: Cookstyle
Starting: Test Kitchen - destroy
==============================================================================
Task         : Execute Chef Component - PREVIEW
Description  : This task allows the execution of any Chef component
Version      : 2.4.152
Author       : Chef
Help         : [More Information](https://chef-partners.github.io/azuredevops-chef-extension/execute-task.html
==============================================================================
Running as root: false
Using sudo: false
/opt/chef-workstation/bin/kitchen destroy
-----> Starting Test Kitchen (v2.6.0)
-----> Destroying <default-ubuntu-1804>...
       Finished destroying <default-ubuntu-1804> (0m0.00s).
-----> Test Kitchen is finished. (0m2.81s)
-----> Starting Test Kitchen (v2.6.0)
-----> Destroying <default-ubuntu-1804>...
       Finished destroying <default-ubuntu-1804> (0m0.00s).
-----> Test Kitchen is finished. (0m2.81s)

Finishing: Test Kitchen - destroy

After installing Chef Workstation with the task, unable to execute Chef command.

In our pipeline we are using the Chef extension to install Chef Workstation, which works great. I have tested with the berks command, it works as well. But anything with "chef" as the command fails:

Running as root: true
Command: C:\opscode\chef-workstation\bin\chef.bat install
'C:\opscode\chef-workstation\bin\chef.bat' is not recognized as an internal or external command,
operable program or batch file.
##[error]Command exited with code: 1
##[section]Finishing: Install policy

Shell expansion inside Execute task

A Policy Build pipeline (using chef export -a) will give a policy archive with a name based on PolicyName-RevisionId.tgz. Publishing this as a build artifact leads to not knowing exactly what the policy archive is named in the artifact directory.
Screenshot 2020-09-18 at 12 35 07

Previously I would do the following and (ab)use shell expansion to get the name of the policy archive (the only file in that directory):

steps:
- script: 'chef push-archive development $(Release.PrimaryArtifactSourceAlias)/$(Build.DefinitionName)/*.tgz'

It appears that shell expansion doesn't work in the execute component task just now. This is my workaround:

steps:
- script: 'mv $(Release.PrimaryArtifactSourceAlias)/$(Build.DefinitionName)/*.tgz $(Release.PrimaryArtifactSourceAlias)/$(Build.DefinitionName)/$(Build.DefinitionName).tgz'
  displayName: 'Rename Policy Archive'
- task: chef-software.chef-preview.execute.component-preview@2
  displayName: 'chef push-archive development'
  inputs:
    component: chef
    arguments: 'push-archive development $(Release.PrimaryArtifactSourceAlias)/$(Build.DefinitionName)/$(Build.DefinitionName).tgz'

A couple other options would just be to rename the build artifact in the policy build pipeline before it's published, or read the policy lock JSON and pass the revision ID between pipelines.

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.