Giter Club home page Giter Club logo

sfdx-travisci's Introduction

sfdx-travisci Build Status

This repository shows one way you can successfully setup Salesforce DX with Travis CI. We make a few assumptions in this README:

If any any of these assumptions aren't true, the following steps won't work.

Getting Started

  1. Make sure you have the Salesforce CLI installed. Check by running sfdx force --help and confirm you see the command output. If you don't have it installed you can download and install it from here.

  2. Confirm you can perform a JWT-based auth: sfdx force:auth:jwt:grant --clientid <your_consumer_key> --jwtkeyfile server.key --username <your_username> --setdefaultdevhubusername

    Note: For more info on setting up JWT-based auth see Authorize an Org Using the JWT-Based Flow in the Salesforce DX Developer Guide.

  3. Fork this repo into your github account using the fork link at the top of the page.

  4. Clone your forked repo locally: git clone https://github.com/<git_username>/sfdx-travisci.git

  5. From you JWT-Based connected app on Salesforce, retrieve the generated Consumer Key.

  6. Set your Consumer Key and Username using the Travis CLI. Note that this username is the username that you use to access your Dev Hub.

    travis env set CONSUMERKEY <your_consumer_key> travis env set USERNAME <your_username>

  7. Add your server.key that you generated previously to the folder called assets.

  8. Open the .travis.yml file and remove the first line that starts with openssl ... and save the file.

  9. From the root folder of your local project, encrypt your server.key value:

    travis encrypt-file assets/server.key assets/server.key.enc --add

  10. IMPORTANT! Remove your server.key: rm assets/server.key, you should never store keys or certificates in a public place.

And you should be ready to go! Now when you commit and push a change, your change will kick off a Travis CI build.

Enjoy!

Contributing to the Repository

If you find any issues or opportunities for improving this repository, fix them! Feel free to contribute to this project by forking this repository and make changes to the content. Once you've made your changes, share them back with the community by sending a pull request. Please see How to send pull requests for more information about contributing to Github projects.

Reporting Issues

If you find any issues with this demo that you can't fix, feel free to report them in the issues section of this repository.

Test

sfdx-travisci's People

Contributors

dcarroll avatar ekapner avatar sbudhirajadoc avatar svc-scm avatar

Stargazers

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

Watchers

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

sfdx-travisci's Issues

Build Error - YAML Line 16

screen shot 2017-07-05 at 4 06 16 pm

My builds keep failing, and I am not sure how to fix this. I tried changing server.key to server.key.enc since that is the file in the assets folder, but both ways failed.

Error in Travis CI build, bad decrypt, digital envelope routines:EVP_DecryptFinal_ex:wrong final block length:evp_enc.c:518:

I've been struggling a lot trying to complete this trailhead module. The first issue was while trying to log in with GitHub creds, which I solved using the GitHub-token flag.

Now, after I Kick-off Continuous Integration, it keeps failing over and over again.

The exception is iv undefined, which is no longer happening, not sure how it got fixed. And this
iv undefined
the last exception has become a real blocker. I can't figure out how to work around this.

Config File:

os: linux
dist: xenial
language: ruby
rvm:
  - 2.0.0
cache: false
env:
  - URL=https://developer.salesforce.com/media/salesforce-cli/sfdx-linux-amd64.tar.xz
before_install:
  - openssl aes-256-cbc -K $encrypted_79bf14636734_key -iv $encrypted_79bf14636734_iv
    -in assets/certs/server.key.enc -out assets/certs/server.key -d
  - export SFDX_AUTOUPDATE_DISABLE=false
  - export SFDX_USE_GENERIC_UNIX_KEYCHAIN=true
  - export SFDX_DOMAIN_RETRY=300
  - export SFDX_DISABLE_APP_HUB=true
  - export SFDX_LOG_LEVEL=DEBUG
  - mkdir sfdx
  - wget -qO- $URL | tar xJ -C sfdx --strip-components 1
  - "./sfdx/install"
  - export PATH=./sfdx/$(pwd):$PATH
  - sfdx --version
  - sfdx plugins --core
  - sfdx force:auth:jwt:grant --clientid $CONSUMERKEY --jwtkeyfile assets/server.key --username $USERNAME --setdefaultdevhubusername -a HubOrg
script:
  - sfdx force:org:create -v HubOrg -s -f config/project-scratch-def.json -a ciorg --wait 3
  - sfdx force:org:display -u ciorg
  - sfdx force:source:push -u ciorg
  - sfdx force:apex:test:run -u ciorg --wait 10
  - sfdx force:org:delete -u ciorg -p

I'm not sure what else to look at or do to make this work.

I'm trying to create a standard development pipeline, which is important to implement CI/CD.

Workstation settings:

Ruby version: 2.7.2
Travis version: 1.10.0
SFDX-cli version: 7.85.1
Already tested in Windows (local station) and AWS Ubuntu server, same results.

travis login error from command line gitbash

    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/travis-1.8.13/lib/travis/tools/github.rb:212:in `rescue in basic_auth'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/travis-1.8.13/lib/travis/tools/github.rb:208:in `basic_auth'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/travis-1.8.13/lib/travis/tools/github.rb:216:in `login'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/travis-1.8.13/lib/travis/tools/github.rb:81:in `possible_tokens'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/travis-1.8.13/lib/travis/tools/github.rb:50:in `each_token'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/travis-1.8.13/lib/travis/tools/github.rb:37:in `with_token'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/travis-1.8.13/lib/travis/cli/login.rb:31:in `login'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/travis-1.8.13/lib/travis/cli/login.rb:40:in `run'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/travis-1.8.13/lib/travis/cli/command.rb:198:in `execute'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/travis-1.8.13/lib/travis/cli.rb:64:in `run'
    from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/travis-1.8.13/bin/travis:18:in `<top (required)>'
    from C:/Ruby26-x64/bin/travis:23:in `load'
    from C:/Ruby26-x64/bin/travis:23:in `<main>'

Travis build fails due to depreciated settings in the project-scratch-de.json

Found this issue while running the trailhead this repository is used for. The ./config/project-scratch-de.json-file contains setting that are depreciated in sfdx. As recommended in the log (which can be found in the Travis CI build section), the parameter orgPreferences:

{
    "orgName": "wade.wegner Example",
    "edition": "Developer",
    "orgPreferences" : {
        "enabled": ["S1DesktopEnabled"]
    }
}

must be changed with settings according to the following:

{
    "orgName": "wade.wegner Example",
    "edition": "Developer",
    "settings": {
        "lightningExperienceSettings": {
           "enableS1DesktopEnabled": true
        }
    }
}

Have seen the warning about the depreciated parameter for scratch org configs in the interactive exercises within the SFDX trailhead lessons already, but the build on travis-ci probably handles the parameter more restricted.

TravisCI build Error

I have got an error.when I build a job
travisci
can you please tell me.how to resolve the probelm
Thanks

Travis CI builds failing on scratch org creation script

I thought I might drop this reference in the existing (and closed) issue #57 but not sure if this is due to some recent change on Salesforce's side?
Running the existing script with --wait 2 resulted in (from Travis logs):

$ sfdx force:org:create -v HubOrg -s -f config/project-scratch-def.json -a ciorg --wait 2
ERROR:  Invalid value was specified for wait. Please provide a wait value greater than 3 minutes.
The command "sfdx force:org:create -v HubOrg -s -f config/project-scratch-def.json -a ciorg --wait 2" exited with 1.

I literally just changed the value to 4, committed and pushed and the build went thru fine.
I'm new to both Salesforce and CI; Not sure if it's a temporary thing?

Error when generating an RSA private key

Hi,
From within the certificates folder, I don't succeed to generate an RSA private key as described on the following screen copy:
image
Any insight would be greatly appreciated.

"The callback URL provided is not valid" on JWT or SFDXURL Auth

I've been trying to login from Travis using the sfdx force:auth:sfdxurl:store command instead. However, when comes the time to spin-up a scratchorg, I am getting that error message:

 ERROR running force:org:create: The callback URL provided is not valid.

Any clue what can cause this / how it can be resolved?

ERROR running force:auth:jwt:grant: We encountered a JSON web token error, which is likely not an issue with Salesforce CLI. Here’s the error: error:0906D06C:PEM routines:PEM_read_bio:no start line

I'm able to use force:auth:jwt:grant locally and successfully log in to my org with the server.key file. However, when the build in travis-ci kicks off, i get this error:

ERROR running force:auth:jwt:grant: We encountered a JSON web token error, which is likely not an issue with Salesforce CLI. Here’s the error: error:0906D06C:PEM routines:PEM_read_bio:no start line

Not sure how to troubleshoot this one

travisci build error

the log like this:

$ openssl aes-256-cbc -K $encrypted_79a2f6093848_key -iv $encrypted_79a2f6093848_iv -in assets/server.key.enc -out assets/server.key -d
bad decrypt
140707428578968:error:0606506D:digital envelope routines:EVP_DecryptFinal_ex:wrong final block length:evp_enc.c:518:
The command "openssl aes-256-cbc -K $encrypted_79a2f6093848_key -iv $encrypted_79a2f6093848_iv -in assets/server.key.enc -out assets/server.key -d" failed and exited with 1 during .
Your build has been stopped.
log.txt

NoMethodError: undefined method `each_pair'

Im getting
NoMethodError: undefined method `each_pair'
while running the below command
travis env set CONSUMERKEY <your_consumer_key> travis env set USERNAME <your_username>

Tar ball file issue travis

Hi all,

I am currently encountering the following issue with the following line of the yml.
Error: "xz: (stdin): File format not recognized
tar: Child returned status 1
tar: Error is not recoverable: exiting now"

Line: "$ wget -qO- $URL | tar xJ -C sfdx --strip-components 1" when referencing the following variable
env:
matrix:
- URL=https://developer.salesforce.com/media/salesforce-cli/sfdx-linux-amd64.tar.xz

Guessing its an issue with what I am doing and not the script itself. Thanks.

Org creation and/or run test commands timeout or take much longer

As per the discussion on StackExchange I am still finding org creation hangs. I updated with the latest .yaml edits made to this repo and still had no luck. Is this build still working? I also see some comments from Travis support on the SE post above.

Finally i used the option described in the StackExchange post, while this works i do see a number of npm obsolete errors so would prefer to use the recommended approach from this repo.

My repository is https://github.com/afawcett/declarative-lookup-rollup-summaries. Note that the yaml also includes some changes to attempt to get test failures to abort the build. These edits in the script section where made afterward.

Deleting Scrach Org failed with

I have been verifying the Travis CI aligned with the Trailhead module "Continuous Integration Using Salesforce DX"

https://trailhead.salesforce.com/en/content/learn/modules/sfdx_travis_ci

I revised the part of .travis.yml as shown below.

script:

However at the last line, deleting Scratch Org failed with following message.

image

Please let me know the correct way or any other workaround.

Best regards,

Scratch org definition is missing a closing } for the settings property

Now it is
{ "orgName": "wade.wegner Example", "edition": "Developer", "settings": { "lightningExperienceSettings": { "enableS1DesktopEnabled": true } }

it should be
{ "orgName": "wade.wegner Example", "edition": "Developer", "settings": { "lightningExperienceSettings": { "enableS1DesktopEnabled": true } } }

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.