Previous Article : Introducing Touchless Deployment & Working Session
Dear All,
In this article, describes how you can automate your SQL deployments to SAP Commission database automatically using Touchless Deployment API’s through CI/CD Process from Github Actions.
Every customer adheres to the CI/CD Process to ensure that their deployment code is compatible, uses version control, and maintains an approval process for deployment because technology is developing quickly.
Continuous integration and continuous deployment (CI/CD) is defined as a set of operating principles and capabilities that enables software changes to be delivered to users in a timely, repeatable, and secure manner by introducing automation into software development processes
Benefits of continuous integration:
- Prevent integration errors
- Committing code frequently
- Continuous feedback mechanisms
- Catch bugs early
- and many more
Tools for continuous integration:
There are many tools for CI. Some of the popular tools are:
- SAP Continuous Integration and Deployment
- Jenkins
- Bitbucket Pipelines
- AWS CodePipeline
- CircleCI
- GitHub Actions
Quickstart using GitHub Actions to deploy your DB Objects
Try out the features of GitHub Actions in 5 minutes or less to deploy your SQL DB Objects automatically using Touchless API’s provided by SAP Commissions
Introduction
You only need a GitHub repository to create and run a GitHub Actions workflow. In this article, you’ll see a workflow that demonstrates some of the essential features of GitHub Actions.
The following example shows you how GitHub Actions jobs can be automatically triggered, where they run, and how they can interact with the code in your repository.
Viewing your workflow results
- On GitHub.com, navigate to the main page of your repository. (Sample repo of my project)
- Under your repository name, click   Actions.
- In the left sidebar, click the workflow you want to see. As you see in the screenshot, I have 3 ways to execute the workflow – Curl, Nodejs and Python to deploy. so whichever you know the programming language,, you can prefer to write it.NodeJs (Javascript)
var axios = require('axios'); var FormData = require('form-data'); var fs = require('fs'); var data = new FormData(); data.append('changeLogZip', fs.createReadStream('liquibase.zip')); tenant = process.env.TENANT username = process.env.USERNAME pwd = process.env.PASSWORD var config = { method: 'post', url: 'https://tenant.callidusondemand.com/TrueComp-SaaS/services/rest/touchlessdeployment/update?changeMasterFile=master.xml', auth: { username: username, password: pwd, }, headers: { ...data.getHeaders() }, data : data }; axios(config) .then(function (response) { console.log(JSON.stringify(response.data)); }) .catch(function (error) { console.log(error); });​
Python
import requests import os tenant = os.environ.get('TENANT') token = 'Basic ' + os.environ.get('TOKEN') url = "https://" +tenant+ ".callidusondemand.com/TrueComp-SaaS/services/rest/touchlessdeployment/update?changeMasterFile=master.xml" print(url) payload={} files=[ ('changeLogZip',('liquibase.zip',open('liquibase.zip','rb'),'application/zip')) ] headers = { 'Authorization': token } print(headers) response = requests.request("POST", url, headers=headers, data=payload, files=files) print(response.text)​
- From the list of workflow runs, click the name of the run you want to see.
- Under Jobs , click the Explore-GitHub-Actions job.
Once Jobs is successful, you can see the information in the database with all the details related to sql statement is executed which was in my Folder1 in github repo. - The log shows you how each of the steps was processed. Expand any of the steps to view its details.
Add a repository secret
you need to add your SAP Commissions Rest API credentials to secret, so that its secured and nobody can see from your repository code. Below example is provided.
- Open your project’s repository in GitHub and click Settings in the top menu.
- Click Secrets in the left menu.
- Click New repository secret.
- Complete the following fields and click Add secret:
- Name – give your secret a suitable name. You can’t use spaces or special characters other than underscores.
- Value – enter the secret, such as your API key.
You can update the value of your secret at any time. Return to Secrets in the repository menu and click Update on the secret you need to change.
References
Learn how to Adopt Version Control for every project
Basics of GIT – [WebIDE Integration with GIT]