Atlantic0
Atlantic0

Reputation: 3571

drone build error: unable to locate package git

My drone.yml file is as follows.. Keep getting the error unable to locate package git. Any suggestions?

 pipeline:
        build:  
            image: python:3.5.1-slim
            commands:
                - apt update && apt install git-core
                - pip install -r requirements.txt
                - nosetests --with-coverage --cover-erase --cover-package 

Upvotes: 1

Views: 747

Answers (1)

Brad Rydzewski
Brad Rydzewski

Reputation: 2563

Have you provided the full yaml? Because the example yaml fails with a Do you want to continue? [Y/n] Abort error message due to the fact that drone is running in non-interactive mode and cannot block and wait for user prompt to continue. It does not fail with the error message specified in the question.

You therefore need to run the command with -y like this:

pipeline:
  build:  
    image: python:3.5.1-slim
    commands:
      - apt-get update
      - apt-get install -y git-core
      - which git

Which results in the following output in my logs:

+ which git
/usr/bin/git

Note that when drone runs your build it turns the commands into a simple shell script, starts the container, and executes the shell script as the entrypoint. So your yaml would turn into something like this:

#!/bin/sh
set -e

apt-get update
apt-get install -y git-core
which get

This means you should be able to test your commands directly from the command line in Docker to pinpoint what looks to be either an image or command issue:

$ docker run -t -i python:3.5.1-slim
# apt-get update && apt-get -y install git-core
# which git

I'm sorry this doesn't fully answer the question, but I was unable to repeat the same error message with the sample yaml provided in the question. If you can provide more clarify in your question, I can come back to this answer and edit in response

Upvotes: 1

Related Questions