Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
fwilhe
Advisor
Advisor
880
Disclaimer: The setup described in this post is highly experimental. I encourage you to try this out in a demo project, but be very cautions until further notice to use this on productive code. In this proof of concept, I’ll use a public GitHub repository and GitHub Actions. This setup is not suitable for commercial software.

Update September 2020: Please don't use this. It was an experiment at the time. Have a look at the project "Piper" GitHub Action instead which does not rely on Jenkinsfile runner, but uses the golang-based binary instead.

Disclaimer: The SAP Cloud SDK for Continuous Delivery and its features have been merged into project "Piper". Therefore we recommend to use the General Purpose Pipeline of project "Piper" instead of the SAP Cloud SDK pipeline. The reasoning for this change, as well as further information on how to adopt the General Purpose Pipeline are described in this guide.


GitHub Actions is a feature for workflow automation on GitHub, which is still in beta as of September 2019. But it won’t hurt to look into what we can do with it right now.

A few months ago, I wrote about an experimental “serverless” SAP Cloud SDK pipeline version, which was demonstrated to work on Travis CI and Azure Pipelines. I tried GitHub Actions at the time, but it was not capable enough, and it was not intended for CI/CD, as GitHub clearly communicated.

But this has changed, Actions is a much more powerful feature now. It is intended to be a CI/CD feature. So, can it run SAP Cloud SDK pipeline?

Yes, it can:


How it works


Essentially, the Action is “just” a Dockerfile with some Metadata. It is based on the existing Jenkinsfile runner by project “piper”. It makes use of the Jenkinsfile runner project, which boots a Jenkins instance, executes the Jenkinsfile in the project directory and throws away the Jenkins instance.

How to use it


Let me reiterate once more that this is not suitable for productive usage as long as Jenkinsfile Runner is in "beta" status.

I’ll assume you have a project based on one of the SAP Cloud SDK maven archetypes. You may also use the Address manager example application.

Create a file called .github/workflows/main.yml with the following content in your project root and enable GitHub Actions in your repository:
on: push
name: Build project
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Run Pipeline
uses: SAP/devops-docker-cx-server/jenkinsfile-runner-github-action@master

This instructs GitHub run the project "piper" Action, which then executes the Jenkinsfile in your project's repository. This may be SAP Cloud SDK pipeline, or another Jenkinsfile you built based on project "piper".

In addition, you’ll need a file called jenkins.yml in the root of your project where the required Jenkins libraries are configured, like in this example:
jenkins:
numExecutors: 10
unclassified:
globallibraries:
libraries:
- defaultVersion: "master"
name: "s4sdk-pipeline-library"
retriever:
modernSCM:
scm:
git:
remote: "https://github.com/SAP/cloud-s4-sdk-pipeline-lib.git"
- defaultVersion: "master"
name: "piper-library-os"
retriever:
modernSCM:
scm:
git:
remote: "https://github.com/SAP/jenkins-library.git"

An example for such a project structure can be found here.

This GitHub Action was inspired by jenkinsci/jenkinsfile-runner-github-actions.