Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The current operating system is not capable of running this task #1242

Open
MichaelSchHtc opened this issue Jul 24, 2024 · 8 comments · Fixed by #1246
Open

The current operating system is not capable of running this task #1242

MichaelSchHtc opened this issue Jul 24, 2024 · 8 comments · Fixed by #1246

Comments

@MichaelSchHtc
Copy link

MichaelSchHtc commented Jul 24, 2024

Describe the bug
I tried to setup the dependabot on a Azure DevOps Server 2020.
I installed the extension (1.30.0.776).
I created the dependabot.yml-File and the pipeline.
But the task in the pipeline fails immediately with this 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."

Repository
It's a private (self hosted) repo.

Expected behavior
I expect the dependabot to complete successfully and create the pull requests to update the old packages.

Extension

  • Host: Azure DevOps Server 2020 Update 1.2
  • Version (Extension): 1.30.0.776

Additional context
I tried to give the Project Collection Service Accounts all possible permissions.
As an Agent pool i use: Ubuntu - 20.04.5 LTS (Focal Fossa).
On the agent docker is installed. Docker-Version: 20.10.21, build baeda1f
This agent is used for the "normal" builds and works without any problems.

The Output is:

Starting: Run Dependabot
==============================================================================
Task         : Dependabot
Description  : Automatically update dependencies and vulnerabilities in your code
Version      : 1.30.776
Author       : Tingle Software
Help         : For help please visit https://github.com/tinglesoftware/dependabot-azure-devops
==============================================================================
##[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.
##[debug]System.InvalidOperationException: 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.
   at Microsoft.VisualStudio.Services.Agent.Worker.TaskRunner.RunAsync()
   at Microsoft.VisualStudio.Services.Agent.Worker.StepsRunner.RunStepAsync(IStep step, CancellationToken jobCancellationToken)
Finishing: Run Dependabot

pipeline-yaml:

name: 'Dependabot CI'
trigger: none
stages:
  - stage: CheckDependencies
    displayName: 'Check Dependencies'
    jobs:
      - job: Dependabot
        displayName: 'Run Dependabot'
        pool:
          name: 'LinuxDocker'
        steps:
        - task: dependabot@1
          displayName: 'Run Dependabot'
          inputs:
            failOnException: false

dependabot-yaml:

version: 2
updates:
- package-ecosystem: "npm"
    directories:
      - "/path/to/package.json/" (replaced fo this issue / bug)
    schedule:
      interval: "weekly"
    labels:
      - "dependabot"
      - "dependencies"
@mburumaxwell
Copy link
Contributor

I don't know if it is possible to run a container in another container specifically for Azure DevOps. That's what I gather from the pool named LinuxDocker. Try the hosted agents (the free minutes per month should generally be enough for weekly runs) or an agent that is not a docker container.

@MichaelSchHtc
Copy link
Author

The agent itself is not a container. The name (LinuxDocker) is choosen to indicate that docker is available.

@mburumaxwell
Copy link
Contributor

I suggest that you check the setup for the private agent. The only requirements are run on an Agent/DeploymentGroup here, docker be present and discoverable here, and the agent be version be recent here.

@MichaelSchHtc
Copy link
Author

All this requirements are fulfilled (Agent-Version is 2.181.2).
I also tried it with another agent (that also meets this requirements) but it throws the same Exception.

I guess that I will try a hosted agent.

@mburumaxwell
Copy link
Contributor

The change in #1246 should ideally solve the issue. I released 1.30.2 you can test and report back.

@MichaelSchHtc
Copy link
Author

The new version (1.30.2.800) doesn't solve the problem. The same error occurs immediately after starting the dependabot-task.

dependabot_error_20240726

@mburumaxwell mburumaxwell reopened this Jul 26, 2024
@mburumaxwell
Copy link
Contributor

Could you give an example of some of the "normal" builds that work without any problems? This will be useful to see tasks in them that work for comparison sake.

@MichaelSchHtc
Copy link
Author

This is the requested pipeline for a "normal" build:

stages:
  - stage: BuildAndTests (Reducted - here the .NET Solution and the react-app gets build / published on another agent)
  - stage: Docker_Build
    displayName: Docker Build
    pool:
      name: 'LinuxDocker'
    variables:
      NumericVersion: $[ stageDependencies.BuildAndTests.BuildAndTests.outputs['CreateVersionVariable.numericVersion'] ]
    jobs:
      - job: DockerImage
        steps:
        - task: Docker@2
          displayName: 'Build Docker'
          inputs:
            containerRegistry: '<Reducted>'
            repository: '<Reducted>'
            command: 'build'
            Dockerfile: 'src/**/Dockerfile'
            tags: |
              $(Build.BuildNumber)
              latest
            arguments: '--build-arg BUILDNUMBER=$(NumericVersion)'
  - stage: Docker_Deploy
    displayName: Docker Deploy
    pool:
      name: 'LinuxDocker'
    jobs:
      - deployment: <Reducted>
        displayName: Deploy
        environment: '<Reducted>'
        strategy:
          runOnce:
            deploy:
              steps:
                - task: Docker@2
                  displayName: 'Push image'
                  inputs:
                    containerRegistry: '<Reducted>'
                    repository: '<Reducted>'
                    command: 'push'
                    tags: |
                      $(Build.BuildNumber)
                      latest

Perhaps relevant: This features are available on the agent (LinuxDocker)

Agent.Name REDUCTED
Agent.Version 2.181.2
_ ./externals/node/bin/node
Agent.ComputerName REDUCTED
Agent.HomeDirectory REDUCTED
Agent.OS Linux
Agent.OSArchitecture X64
curl /usr/bin/curl
docker /usr/bin/docker
dotnet /usr/bin/dotnet
git /usr/bin/git
HOME REDUCTED
InteractiveSession False
INVOCATION_ID REDUCTED
JOURNAL_STREAM 9:45971
LANG en_US.UTF-8
LOGNAME REDUCTED
PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
PWD REDUCTED
python /usr/bin/python
python3 /usr/bin/python3
sh /bin/sh
SHELL /bin/bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants