Git Product home page Git Product logo

osf-builder-suite-for-sfcc-deploy-plugin's Introduction

OSF Builder Suite For Salesforce Commerce Cloud :: Deploy

Deploy your build to a Salesforce Commerce Cloud instance

OSF Builder Suite For Salesforce Commerce Cloud :: Deploy is an alternative to Salesforce Commerce Cloud Build Suite and is a very easy-to-use and highly configurable Jenkins plugin that is used to deploy your builds to your Salesforce Commerce Cloud continuous integration sandbox, development or staging instance. Being a native plugin for Jenkins and not a set of scripts it tightly integrates with it providing the best and easiest to use experience. You can make use of any existing Jenkins plugin (source code management, email notification, reports, etc.), configure it accordingly and use it.

OSF Builder Suite For Salesforce Commerce Cloud :: Deploy wants to be the first in a set of plugins that will make your life easier in regards to building your code and deploying it. We have a few ideas for what to build next, but we also take requests into account, so if you think of something you can let us know and we'll take it under consideration for a future plugin.

If you have a bug to report or maybe a feature that you wish to request, please do so on the project's issues page.

Features

  • Simple. It does one thing, and it does it well.
  • Easy to install, use and keep updated.
  • Easy to configure. The plugin can be configured from the Jenkins web interface.
  • Support for classical mode, Jenkins Pipelinesand also the new modern Blue Ocean interface.
  • Super flexible. Every little thing is configurable so that the plugin can be easily adjusted to your workflow.
  • Integrated with the Jenkins credentials plugin so that your credentials are safely stored encrypted.
  • Support for two factor authentication
  • Build info cartridge. A inf_build cartridge will be created as part of the build process that can be used to display information about the build number, version, when the build was made and who made it, in the storefront. This information can be displayed in the page source, title or by using the OSF Builder Suite For Salesforce Commerce Cloud :: Deploy plugin for Chrome.
  • Support for builds bigger than 100MB. The build is split into multiple parts that are deployed one by one so you don't hit the 100MB upload quota limit that Salesforce Commerce Cloud has.
  • Good documentation. Every option is documented both here on this page but also inline in Jenkins's UI by clicking the question mark icon next to the item for which you wish to display the help information.
  • Support for HTTP proxy with basic or NTLM authentication.
  • Free
  • Open source

Installation

Just go to Manage Jenkins > Manage Plugins > Available, search for OSF Builder Suite, select OSF Builder Suite For Salesforce Commerce Cloud :: Deploy and click Download now and install after restart button.

Configuration

Hostname of the SFCC instance where this build should be deployed. Examples:

cert.staging.realm.customer.demandware.net For deployments to a staging instance that has two factor auth enabled. 
staging-realm-customer.demandware.net For deployments to a staging instance that does not have two factor auth enabled.
development-realm-customer.demandware.net For deployments to a development instance.
devNN-realm-customer.demandware.net For deployments to a sandbox instance.

Two Factor Auth credentials of type OSF Builder Suite :: Two Factor Auth Credentials for the SFCC instance where this build should be deployed. Select - none - if you deploy to a instance that does not require two factor auth.

Open Commerce API credentials of type OSF Builder Suite :: Open Commerce API Credentials for the SFCC instance where this build should be deployed.

The version to be used by the calls made to OCAPI. The Open Commerce API Version starts with the character v (lowercase) followed by the actual version number, separated by an underscore.

For example: v19_10

Name of the code version that is being deployed. This will be added as a suffix to the one generated by the builder.

Example: If you set it to dev then the code version will be bN_YYYYMMDD_dev with N the number of the current build, YYYY four digits year, MM two digits month, DD two digits day and dev at the end.

When this option is checked, a new cartridge named inf_build will be created. This cartridge can be used to display information about the build number, version, when the build was made and who made it, in the storefront.

This information can be displayed in the page source, title or by using the OSF Builder Suite For Salesforce Commerce Cloud :: Deploy plugin for Chrome.

When this option is checked, the build will also be activated after it was deployed. If left unchecked the build will only be deployed to the target instance without being activated.

List of sources where the builder will look for cartridges in the form of a path (relative to the workspace) to a directory where the builder will look for cartridges.

Example: scm/my-git-repo/cartridges

You can also define a list of patterns to be ignored. If a path matches any of the patterns in this list then it will be ignored and not added to the build. The pattern needs to be relative to the source path defined above.

When a path is matched against a pattern, the following special characters can be used:

? Matches one character (any character except path separators)
* Matches zero or more characters (not including path separators)
** Matches zero or more path segments

Examples:

**/*.js Matches all .js files/dirs in a directory tree
node_modules/** Matches the node_modules folder and all its contents
test/a??.js Matches all files/dirs which start with an a, then two more characters and then .js, in a directory called test
** Matches everything in a directory tree
**/test/**/XYZ* Matches all files/dirs which start with XYZ and where there is a parent directory called test (e.g. abc/test/def/ghi/XYZ123)

Path (relative to the workspace) to a temp directory, that will be used during the build. If the directory does not exist, it will be created by the builder and it will also be automatically cleaned up before each build.

Example: tmp/code

If your Jenkins server sits behind a firewall and does not have direct access to the internet, you can specify the HTTP proxy host in this field to allow Jenkins to connect to the internet trough it.

This field works in conjunction with the proxy host field to specify the HTTP proxy port.

This field works in conjunction with the proxy host field to specify the username used to authenticate with the proxy.

If this proxy requires Microsoft's NTLM authentication scheme then the domain name can be encoded within the username by prefixing the domain name followed by a back-slash \ before the username, e.g ACME\John Doe.

This field works in conjunction with the proxy host field to specify the HTTP proxy password.

When this option is checked, the builder will no longer validate the SSL certificate and hostname of the target instance.

This has potential security implications so make sure you know what you are doing before enabling this option!

Open Commerce API Settings

Go to Administration > Site Development > Open Commerce API Settings, select type Data, select context Global and add following configuration:

{
    "_v": "19.10",
    "clients": [
        {
            "client_id": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
            "resources": [
                {
                    "resource_id": "/code_versions/*",
                    "methods": ["put", "patch"],
                    "read_attributes": "(**)",
                    "write_attributes": "(**)"
                },
                {
                    "resource_id": "/jobs/*/executions",
                    "methods": ["post"],
                    "read_attributes": "(**)",
                    "write_attributes": "(**)"
                },
                {
                    "resource_id": "/jobs/*/executions/*",
                    "methods": ["get"],
                    "read_attributes": "(**)",
                    "write_attributes": "(**)"
                }
            ]
        }
    ]
}

Go to Administration > Organization > WebDAV Client Permissions and add following configuration:

{
    "clients": [
        {
            "client_id": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
            "permissions": [
                {
                    "path": "/cartridges",
                    "operations": [
                        "read_write"
                    ]
                },
                {
                    "path": "/impex",
                    "operations": [
                        "read_write"
                    ]
                }
            ]
        }
    ]
}

Whitelist cert.staging.???.???.demandware.net hostname

Go to Administration > Sites > Manage Sites > Business Manager - Hostnames and whitelist cert.staging.???.???.demandware.net

Jenkins Pipeline Configuration

Here's a sample pipeline configuration to get you started:

node {
    stage('Cleanup') {
        cleanWs()
    }

    stage('Git') {
        dir('scm/github.com/???/???') {
            git(
                branch: '???',
                credentialsId: '???',
                url: '[email protected]:???/???.git'
            )
        }
    }

    stage('Yarn') {
        dir('scm/github.com/???/???') {
            nodejs('NodeJS v12') {
                sh('yarn install')
            }
        }
    }

    stage('Build') {
        dir('scm/github.com/???/???') {
            nodejs('NodeJS v12') {
                sh('yarn run webpack:prd')
            }
        }
    }

    stage('CodePush') {
        osfBuilderSuiteForSFCCDeploy(
            hostname: '???',
            tfCredentialsId: '???',
            ocCredentialsId: '???',
            ocVersion: 'v19_10',
            buildVersion: 'dev',
            sourcePaths: [[sourcePath: 'scm/github.com/???/???/cartridges']],
            activateBuild: true,
            createBuildInfoCartridge: true,
            tempDirectory: 'tmp/code'
        )
    }

    /* See https://plugins.jenkins.io/osf-builder-suite-for-sfcc-data-import
    stage('DataPush') {
        osfBuilderSuiteForSFCCDataImport(
            hostname: '???',
            tfCredentialsId: '???',
            ocCredentialsId: '???',
            ocVersion: 'v19_10',
            archiveName: 'metadata',
            sourcePath: 'scm/github.com/???/???/metadata',
            importStrategy: 'DELTA',
            tempDirectory: 'tmp/data'
        )
    }
    */
}

You can also always consult the pipelines documentation available at https://jenkins.io/doc/book/pipeline/ or check the pipeline syntax link right inside Jenkins on the left navigation menu.

Version history

https://github.com/jenkinsci/osf-builder-suite-for-sfcc-deploy-plugin/releases

FAQ

  • Q: Why am I getting the InvalidHostHeaderException while the plugin is making an OCAPI request?
  • A: Go to Administration > Sites > Manage Sites > Business Manager - Hostnames and whitelist cert.staging.???.???.demandware.net.

Dev

  • mvn hpi:run
  • mvn clean package hpi:hpi
  • mvn release:prepare release:perform

osf-builder-suite-for-sfcc-deploy-plugin's People

Contributors

bhunter avatar danechitoaie avatar dependabot[bot] avatar notmyfault avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

osf-builder-suite-for-sfcc-deploy-plugin's Issues

OCAPI Connection to Staging

Hi guys,

The deployment to a normal SB was working perfect.
I configured now everything for the deployment to the staging instance. (with certificates etc.)

I get always :-(
host: cert.staging.euXXX.XXXXX.demandware.net

Failed to authenticate with OCAPI! 400 - Bad Request!
Response=<html>
<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<center>The plain HTTP request was sent to HTTPS port</center>
<hr><center>nginx</center>
</body>
</html>

We have the 2FA active for the client organisation.
This my OCAPI Config data/global

{
    "_v": "19.5",
    "clients": [
        {
            "client_id": "MY_SECRECT_CODE",
            "resources": [
                {
                    "resource_id": "/code_versions/*",
                    "methods": ["put", "patch"],
                    "read_attributes": "(**)",
                    "write_attributes": "(**)"
                }
            ]
        }
    ]
}

Is there anything else that I have to setup?

Error running the Jenkins Job: invalid_client

I am trying to build into a sandbox and getting this error:
ERROR: Failed to authenticate with OCAPI! 401 - !
Response={"error_description":"Client authentication failed","error":"invalid_client"}
I even trying using the cient_id: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa but still gives me this error.
Do anyone knows what might be causeing this issue?

Missing "Open Commerce API Credentials"! We can't deploy the build without proper credentials, can't we?

Hi,

I am trying to configure Jenkins to deploy cartridges to Salesforce using OSF deploy plugin, I have followed below wiki to create a jenkinsfile, but its failing with the above error https://wiki.jenkins.io/display/JENKINS/OSF+Builder+Suite+For+Salesforce+Commerce+Cloud+Deploy+Plugin
here is my jenkins file

#!/usr/bin/env groovy

properties([
buildDiscarder(logRotator(numToKeepStr: '20')),
disableConcurrentBuilds()
])
node('slave name') {

stage('Checkout code from Git') {
    scmVars = checkout scm
    print "BRANCH ${scmVars.GIT_BRANCH}"
    print "COMMIT ${scmVars.GIT_COMMIT}"
    print "PREVIOUS COMMIT ${scmVars.GIT_PREVIOUS_COMMIT}"
}
stage('build') {
    sh "cd storefront-reference-architecture && npm ci && npm run compile:js && npm run compile:scss"
}
stage ('deploy') {
    osfBuilderSuiteForSFCCDeploy(
            hostname: "<hostaname>",
            bmCredentialsId: "d5564126854d51-b1b9-c57d01307dc4",
            OCAPICredentialsId: "b487485-1dff-47cf-8364-6e0f09aceafe",
            buildVersion: "dev",
            createBuildInfoCartridge: true,
            sourcePaths: [
                    [sourcePath: "store/cartridges"]
            ],
            actuvateBuild: true,
            tempDirectory: 'tmp/build'
    )
}

}

ERROR: Missing "Open Commerce API Credentials"! We can't deploy the build without proper credentials, can't we?
Finished: FAILURE

even I gave the OCAPI credentials it's throwing error saying "it couldn't find one" and I am wondering how can I mention the ocapi version number in jenkins file.

Any suggertions on how to fix this ?

Thank you

Unable to Create New Code Version with 2FA

Hi,

I am trying to set up Jenkins to use a certificate to push to staging but am getting the following error:

[+] Creating new code version
 - cert.staging.webstore.____.demandware.net (b5_20200206_staging)
Failed to create the new code version! 403 - Forbidden!
Response={"_v":"19.10","fault":{"arguments":{"method":"PUT","path":"/data/v19_10/code_versions/b5_20200206_staging"},"type":"ClientAccessForbiddenException","message":"Access to resource 'PUT /data/v19_10/code_versions/b5_20200206_staging' isn't allowed for the current client."}}

I have configured the Two Factor Auth credentials according to the post at the bottom of https://xchange.demandware.com/docs/DOC-44159#start=25

I have also whitelisted cert.staging.webstore.____.demandware.net per the readme (with our domain where the ___ is).

Any idea what is causing the error? I am able to push to development just fine without a certificate.

Thanks,
David

Deployment failure to development environment

I am trying to deploy the code to development environment but resulting in the below error.

ERROR: 500 - Internal Server Error!
Finished: FAILURE

Code version is getting created but no cartridges are available. Builds to my local sandbox and STG are working fine and configurations are similar across all environments.

Validated the logs but couldn't find anything.

Could you please let us know if you come across this issue or the way to log the relevant errors?

Thanks,
Satya

Unable to create code version to development

Thank you for building and maintaining this!!

I've got the webDav and OCAPI data settings using client id "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" and set up the open api credentials in Jenkins to the same. The build however errors out with a 411 failed to create code version -see clip of console out below. It is successful when I build to my sandbox and in the API Explorer.
I can also use a client key created for Staging and Dev, w/ webdav and OCAPI settings that was made for develop and that throws the same error in the console below. It is also successful from the API Explorer and Postman.

-----Console output ----------

[+] Creating new code version
 - development-<redacted>-realm-corp.demandware.net (b26_20210325_dev)
Deleting 1 temporary files
ERROR: Failed to create the new code version! 411 - Length Required!
Response=<HTML><HEAD>
<TITLE>Bad Request</TITLE>
</HEAD><BODY>
<H1>Bad Request</H1>
Your browser sent a request that this server could not understand.<P>
Reference&#32;&#35;7&#46;4d012417&#46;1616693934&#46;35d99813
</BODY>
</HTML>

didnt find info on why inf_build folder is getting created in cartridges folder along with other cartridges in sandbox

Describe your use-case which is not covered by existing documentation.

hi i didnt find info on why inf_build folder is getting created in cartridges folder along with other cartridges while uploading to sandbox. please check 2 images for reference. is there any way to avoid automatically creating the inf_build folder? please let me know thanks

Reference any relevant documentation, other materials or issues/pull requests that can be used for inspiration.

No response

Error: 524 - Origin Time-out!

Hi Daniel,

We are using "OSF Builder Suite For Salesforce Commerce Cloud :: Deploy" plugin version 1.0.14.
We are currently doing build for SFRA version and when i triggering a build i am getting following error:-
524 - Origin Time-out!

Initially i am executing a script to compile JS and CSS files of the required cartridges.

At the time of uploading the cartridges, i am getting this error.
It fails at "Uploading Cartridges" step. None of the cartridge gets uploaded, at the time of uploading first cartridge only it fails.

timing out

Jenkins version 2.222.3
OSF version : 1.0.8

Hi, Can any one help me figuring out this issue? When we run the build the cartridges (code deployment) are uploading to staging environment cert.staging.web.customer.demandware.net about 70 percent and then timing out. This has been working for years without any issues, May 18th was last successful build and since last week we are seeing this issue. Any help on this would be greatly appreciated.

ERROR: Exception thrown while making HTTP request!
org.apache.http.conn.HttpHostConnectException: Connect to cert.staging.web.customer.demandware.net:443 [cert.staging.web.customer.demandware.net/IP] failed: Connection timed out (Connection timed out)

Caused by: java.net.ConnectException: Connection timed out (Connection timed out)
Thanks
Dilli

ERROR: Exception thrown while making HTTP request!

Hi,
I have configured OSF plugin to development environment as below, it worked all good but when I changed the host-name to my staging environment(staging-.demandware.net) it started failing with the error below. Can someone please help me in understanding what I am doing wrong.

Thank you

Plugin configuration in jenkins file -
osfBuilderSuiteForSFCCDeploy(
hostname: "",
bmCredentialsId: "abcdefghijklmn",
ocCredentialsId: "abcdefghijklmnopqr",
ocVersion: 'v19_5',
buildVersion: "dev",
createBuildInfoCartridge: true,
sourcePaths: [
[sourcePath: "src/cartridges"]
],
actuvateBuild: true,
tempDirectory: 'tmp/build'
)

error-

ERROR:
Exception thrown while making HTTP request!
org.apache.http.NoHttpResponseException: staging-.demandware.net:443 failed to respond
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:157)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
at org.jenkinsci.plugins.osfbuildersuiteforsfcc.deploy.OpenCommerceAPI.createCodeVersion(OpenCommerceAPI.java:173)
at org.jenkinsci.plugins.osfbuildersuiteforsfcc.deploy.DeployBuilder$DeployCallable.invoke(DeployBuilder.java:1371)
at org.jenkinsci.plugins.osfbuildersuiteforsfcc.deploy.DeployBuilder$DeployCallable.invoke(DeployBuilder.java:534)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3042)
at hudson.remoting.UserRequest.perform(UserRequest.java:212)
at hudson.remoting.UserRequest.perform(UserRequest.java:54)
at hudson.remoting.Request$2.run(Request.java:369)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.