Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to schedule a R script in YAML file to run daily via Bitbucket Pipelines?

aqsmith08 January 14, 2019

Let's pretend I have a R script called foo.R that outputs a CSV file. I'd like to schedule foo.R to run 1x per day. I found that I should create a YAML file and then schedule it via the Bitbucket GUI per this article.

My YAML file looks like this:

pipelines:
custom:
foo-pipeline: # The name displayed in the Bitbucket Cloud GUI
- step:
script:
- echo "Starting Bitbucket Pipeline!"
- sudo Rscript -e "/file/path/to/foo.R"
- echo "Bitbucket Pipeline complete!"

That receives and error with this message -- sudo: Rscript: command not found.

I'm not sure how to figure this out and would love advice. Thanks!

2 answers

1 accepted

0 votes
Answer accepted
aqsmith08 January 18, 2019

Thanks to Gonchik and some investigation, I figured this out. The YAML looks like this --

image: rocker/tidyverse

pipelines
:
custom:
foo-pipeline: # The name displayed in the Bitbucket Cloud GUI
- step:
script:
- Rscript "file/path/to/foo.R"
- git add "file/path/to/foo.csv"
- git commit -m "[Pipeline] Add foo CSV file."
- git push

Works great and automatically pushes the CSV file into the repo I'm working in. 

aqsmith08 January 16, 2019

At first, I mistakenly thought I could use the Default but that's not the case since it doesn't include R. I'll try using the rocker/tidyverse one and see if that does the trick.

Gonchik Tsymzhitov
Community Champion
January 19, 2019

Good :) 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events