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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,459,770
Community Members
 
Community Events
176
Community Groups

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.

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

Atlassian Community Events