ubuntuencryptioncontinuous-integrationtravis-citravis-ci-cli

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 first exception was iv undefined, which is no longer happening, not sure how it got fixed. And this

:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:evp_enc.c

the last exception has become a real blocker. I can't figure out how to work around this.

Job Log:

enter image description here

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:

Already tested in Windows (local station) and AWS Ubuntu server, same results.


Solution

  • Finally, I was able to solve it.

    The reasons why this was failing:

    1. Trailhead module information about login is out of date, travis login --org was not working- keep throwing "Not found" exception, so I solved it using travis login --org --github-token.
    2. When using travis encrypt-file path-to-secret-file/secret-file.txt path-to-secret-file/secret-file.txt.enc --add I wasn't providing the endpoint, in this case since I was logged to the Org end-point I needed to specify the same in the command by adding --org at the end.
    3. Since Travis-org is moving soon to Travis-com, and Travis-org only fetches public repositories, I needed to move this to Travis-com, so I logged out and logged in again but this time pointing to --com in both commands (login and encrypt-file).

    Taking these 3 considerations I was able (finally) to make it work.

    Is pretty bad not having this information accessible.

    Only information that gave me an idea of what probably was happening was this banner.

    enter image description here

    Basically nothing.