Hi,
I have configured Bitbucket Pipeline and my inital pipeline has ran successfully. I have configured bitbucket-pipelines.yml file in main branch as well but I am not able to run the piple and I am getting following message "no pipelines found"
Can anyone help here ??
Regards,
Amit Vyas
Hello @Amit Vyas and welcome to the Community!
I suspect no pipelines are showing up in the dropdown because your bitbucket-pipelines.yml file in the main branch currently doesn't have any pipeline definition that applies to the main branch (see Pipelines start conditions)
Could you share with us your YML file so we can take a look and check if this is the case?
Thank you, @Amit Vyas !
Patrik S
Hi @Patrik S
Thanks for your reply.
Below is my bitbucket-pipelines.yml file details
# This is an example Starter pipeline configuration# Use a skeleton to build, test and deploy using manual and parallel steps# -----# You can specify a custom docker image from Docker Hub as your build environment.image: atlassian/default-image:3pipelines:default:- parallel:- step:runs-on:- self.hosted- linuxname: 'Build and Test'command: ["/bin/sh", "-c"]args:- echo "TAR html folder located in /var/www/ directory";tar -cvf /tmp/html.tar /var/www/html;gzip /tmp/html.tar;script:- echo "Your build and test goes here..."I hope this will help
Regards,
Amit Vyas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Amit Vyas !
Thanks for sharing the YML content.
The syntax you have used in your YML file is slightly incorrect, so this is the reason why the pipeline is not able to parse that file and show the available options in the dropdown.
The command and args attributes you have used are not supported attributes by pipelines. All the commands and their respective arguments must be placed under the script section of the step, just as you would do if you were expecting the commands in a terminal session.
I've made some adjustments in your YML file to fix the syntax so you can use it as an example :
image: atlassian/default-image:3
pipelines:
default:
- parallel:
steps:
- step:
runs-on:
- 'self.hosted'
- 'linux'
name: 'Build and Test'
script:
- echo "TAR html folder located in /var/www/ directory"
- tar -cvf /tmp/html.tar /var/www/html
- gzip /tmp/html.tar
Feel free to make any changes to that and add/remove commands in the script section.
You can also make use of the Bitbucket Pipelines Validator to verify if the syntax is valid before pushing the file to your repository.
Once you push the changes to the YML file in the main branch with fixed syntax, you should be able to see that pipeline in the dropdown list.
Thank you, @Amit Vyas !
Patrik S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Amit Vyas ,
I noticed there was a slight syntax error while pasting the YML here, and there needs to be a space between the pipelines and default attributes in the YML file :
image: atlassian/default-image:3
pipelines:
default:
- parallel:
steps:
- step:
runs-on:
- 'self.hosted'
- 'linux'
name: 'Build and Test'
script:
- echo "TAR html folder located in /var/www/ directory"
- tar -cvf /tmp/html.tar /var/www/html
- gzip /tmp/html.tar
Could you try the above and let us know how it goes? Please note that when copying/pasting, some format might be lost, so make sure that no warning/errors show in the online editor validator (https://bitbucket-pipelines.atlassian.io/validator) before pushing the file. If any error is showing in the validator, please make the necessary changes (usually missing spaces) before pushing it to the repository.
I would suggest copying the above to a text editor (like Sublime) first, to confirm no hidden characters are being copied, and once adjusted, copy from Sublime to the editor in Bitbucket UI.
Also, make sure the changes are being applied to the main branch, where you want the pipeline to be triggered.
Thank you, @Amit Vyas !
Patrik S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Patrik S
Thank your sharing the validator link, this was really helpful. it was my mistake that I typed bitbucket-pipelines.yml file name wrongly at first time it was like this "bitbcuket-pipelines.yml". After fixing the name and YML validator I was able to run the pipeline using my linux runner.
I would like to understand how my runner will execute the required commands ? is there any documentations links available to understand this ?
I am asking this becuase, I could see the logs in pipeline that TAR command couldn't run successfully.
On my local linux machine I am able to run this command without any error.
Below is the output for your reference.
Runner matching labels:
- linux
- self.hosted
Runner name: neysa-workspace-runner
Runner UUID: {3cea9453-c189-5a50-b393-6800c702424b}
Runner labels: self.hosted, linux
Runner version:
current: 1.518
latest: 1.518
+ umask 000
+ GIT_LFS_SKIP_SMUDGE=1 retry 6 git clone --branch="main" --depth 50 https://x-token-auth:$REPOSITORY_OAUTH_ACCESS_TOKEN@bitbucket.org/$BITBUCKET_REPO_FULL_NAME.git $BUILD_DIR
Cloning into '/opt/atlassian/pipelines/agent/build'...
+ git reset --hard 38346ca3dda4a1ac9e4d936343989f5e8732c155
HEAD is now at 38346ca bitbcuket-pipelines.yml edited online with Bitbucket
+ git config user.name bitbucket-pipelines
+ git config user.email commits-noreply@bitbucket.org
+ git config push.default current
+ git config http.${BITBUCKET_GIT_HTTP_ORIGIN}.proxy http://localhost:29418/
+ git remote set-url origin http://bitbucket.org/$BITBUCKET_REPO_FULL_NAME
+ git reflog expire --expire=all --all
+ echo ".bitbucket/pipelines/generated" >> .git/info/exclude
+ chmod 777 $BUILD_DIR
Default variables:
BITBUCKET_BRANCH
BITBUCKET_BUILD_NUMBER
BITBUCKET_CLONE_DIR
BITBUCKET_COMMIT
BITBUCKET_GIT_HTTP_ORIGIN
BITBUCKET_GIT_SSH_ORIGIN
BITBUCKET_PARALLEL_STEP
BITBUCKET_PARALLEL_STEP_COUNT
BITBUCKET_PIPELINE_UUID
BITBUCKET_PROJECT_KEY
BITBUCKET_PROJECT_UUID
BITBUCKET_REPO_FULL_NAME
BITBUCKET_REPO_IS_PRIVATE
BITBUCKET_REPO_OWNER
BITBUCKET_REPO_OWNER_UUID
BITBUCKET_REPO_SLUG
BITBUCKET_REPO_UUID
BITBUCKET_SSH_KEY_FILE
BITBUCKET_STEP_RUN_NUMBER
BITBUCKET_STEP_TRIGGERER_UUID
BITBUCKET_STEP_UUID
BITBUCKET_WORKSPACE
CI
DOCKER_HOST
PIPELINES_JWT_TOKEN
Images used:
build: atlassian/default-image@sha256:496b5b602817d68ea0d0b6a030708cd1017f7cb28d69b74f22dfe26229199f91
Runner warnings:
atlassian/default-image:3: Your kernel does not support memory swappiness capabilities or the cgroup is not mounted. Memory swappiness discarded.
+ echo "TAR html folder located in /var/www/ directory"
TAR html folder located in /var/www/ directory
+ tar -cvf /tmp/html.tar /var/www/html
tar: Removing leading `/' from member names
tar: /var/www/html: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
Searching for test report files in directories named [test-reports, TestResults, test-results, surefire-reports, failsafe-reports] down to a depth of 4
Finished scanning for test reports. Found 0 test report files.
Merged test suites, total number tests is 0, with 0 failures and 0 errors.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Amit Vyas ,
From the logs you shared, it seems you are using Linux docker runners. When a pipeline is triggered and the step is configured to run in a Linux docker runner, the runner will :
1. start a fresh build container using the docker image you have configured in the bitbucket-pipelines.yml file
2. clone the repository inside the build container
3. execute each command of your yml script inside the build container.
4. once the build is completed, the build container exits and the runner waits for the next pipeline step.
The error that tar command is returning is that the folder /var/www/html does not exist in your repository and neither was created as a result of a command in your build, hence tar was not able to find the files and errored out.
This folder likely just currently exists in your local machine, which explains why the command works in your machine and not inside the build container.
You can push that folder and its content directly to your repository, or you can generate those files as an output of a command in your build (a command that will build your code and generate the files under /var/www/html, for example).
Alternatively, you might opt to use Linux Shell runners instead. Shell runners are executed directly in a terminal session on the host machine (no container involved), so you will be able to access the files and executables of the host just like you would do when executing the commands locally. You can learn more on Setup Linux Shell runner.
Thank you, @Amit Vyas !
Patrik S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.