Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

bash: apt-get: command not found

My pipeline bitbucket-pipelines.yml is below

image: maven:3.6.3

pipelines:
default:
- step:
name: Install Unzip
script:
- apt-get update
- apt-get install unzip
- step:
name: Install Gauge
script:
- curl -SsL https://downloads.gauge.org/stable | sh
- step:
name: Install Gauge-Java Plugin
script:
- gauge install java
- step:
name: Run Pre-Requisites
caches:
- maven
script:
- mvn test-compile gauge:execute -DspecsDir="specs/Get Auth Token.spec" -Denv="uat"
- step:
name: Run Regression Tests
caches:
- maven
script:
- mvn test-compile gauge:execute -DspecsDir="specs" -Denv="uat" -DinParallel=true

When I run this. I am getting error,

bash: apt-get: command not found

I am working on a maven project 

1 answer

0 votes

This would suggest that apt-get is not in the path in the build environment.

Is the build server an apt based linux distribution?  Are you running the build with root privileges (at least for the software installation part of it)?

Hi Nic,

My project is a maven project. As I used the pipeline template as a maven template, I am not sure its linux distribution.

image: maven:3.6.3

 Can I use image as Debian and work with maven project?

Your build tools are not really relevant here (although, yes, Maven is usable on pretty much all Linux distributions)

You need to understand what your build process is doing, and put it together properly.  Why is it trying to run apt-get?  What is that step supposed to do?  As Apt is only valid on certain operating systems, you're going to need to do your builds on the right one.

My project is using an outside API call gauge(https://docs.gauge.org/latest/index.html) which need to be installed on the host machine. When installing it using the curl command (curl -SsL https://downloads.gauge.org/stable | sh) it says "unzip command not found". To install "unzip". I am using "apt-get"

I changed image to "atlassian/default-image:2" and it is now installing gauge dependency. But in the 3rd step "Install Gauge-Java Plugin", it says,

gauge command not found

 

image: atlassian/default-image:2

pipelines:
  default:
    - step:
        name: Install Unzip
        script:
          - echo "Installing Unzip"
          - apt-get update
          - apt-get install unzip
    - step:
        name: Install Gauge
        script:
          - echo "Installing Gauge"
          - curl -SsL https://downloads.gauge.org/stable | sh
    - step:
        name: Install Gauge-Java Plugin
        script:
          - echo "Installing Gauge-Java Plugin"
          - gauge install java
    - step:
        name: Run Pre-Requisites
        caches:
          - maven
        script:
          - echo "Running Pre-Requisites"
          - mvn test-compile gauge:execute -DspecsDir="specs/Get Auth Token.spec" -Denv="uat"
    - step:
        name: Run Regression Tests
        caches:
          - maven
        script:
          - echo "Running Regression Tests"
          - mvn test-compile gauge:execute -DspecsDir="specs" -Denv="uat" -DinParallel=true

I'm not familiar with gauge, but that's not the core of the actual problem.

You need to take a step back and look at what you're doing.  The bitbucket pipeline yaml file looks fine, but it is clear that you do not understand what it is trying to do.

It is set up to run a build on a certain type of operating system, and you do not appear to be using one of the right type.

Rather than try to botch the OS in the build environment, you should go back to the docs for the build and look at what it is expecting to be built on.  Then you should do one of three things:

  • Use the OS that the build is for
  • Use the yaml file for the OS you currently have
  • Convert the build to suit the OS you currently have

I think after installing gauge, it is reflecting on other pipeline steps. Because when I use all the commands on one step it is working fine without any issues.

image: atlassian/default-image:2

pipelines:
default:
- step:
name: Installing Dependencies & Runing Regression Test Suite
caches:
- maven
script:
- echo "Fetching Package Updates"
- apt-get update
- echo "Installing Unzip"
- apt-get install unzip
- echo "Installing Gauge"
- curl -SsL https://downloads.gauge.org/stable | sh
- echo "Getting Gauge Version"
- gauge -v
- echo "Installing Gauge-Java Language Runner"
- gauge install java --version 0.7.15
- echo "Running Pre-Requisites"
- mvn test-compile gauge:execute -DspecsDir="specs/Get Auth Token.spec" -Denv="uat"
- echo "Running Regression Tests"
- mvn test-compile gauge:execute -DspecsDir="specs" -Denv="uat" -DinParallel=true

I can't help you any further, you've basically got a broken build process that pipelines can't run.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

⭐ Calling all Bitbucket and DevOps experts: Special showcase opportunity ⭐

Hi, Bitbucket community! Are you a DevOps practitioner (or know one in your network)? Do you have DevOps tips, tricks, or learnings you'd like to share with the community? If so, we'd love to hea...

1,522 views 4 8
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you