Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

bash: apt-get: command not found

Osanda Deshan July 24, 2021

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
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 24, 2021

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)?

Osanda Deshan July 24, 2021

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?

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 24, 2021

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.

Osanda Deshan July 24, 2021

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"

Osanda Deshan July 24, 2021

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
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 24, 2021

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
Osanda Deshan July 24, 2021

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
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 24, 2021

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

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 28, 2022

One of my colleagues has asked me to explain that last comment because it was not too clear to a couple of our clients.

The build process is broken somewhere.  The error messages are coming from the build that the pipeline is invoking, not the pipeline process (which is supposed to be controlling the build)

You can tell pipelines to do whatever you want, but if you tell it to do something that isn't going to work, then it is going to tell you that.

Step back.  Then tell the build to work.  Get the build to work, then ask other things to trigger the build.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events