Encrypted environment variable not set on pull request

Rainer Ziller's Avatar

Rainer Ziller

13 Apr, 2015 09:43 AM

I have set up a project to use different settings for different branches while building.
Specifically, I am only deploying the master branch, and for the master branch, there will be also some code added from a different repo (there is a repo for frontend and backend, and for the master branch, I want to deploy the frontend as a virtual directory to my Azure Cloudservice backend)

This is working fine, but when I create a pull request (requesting to merge onto the master, a encrypted environment variable I am using is not set.

This is what my appveyor.yml looks like:

- # master branch
  branches:
    only:
      - master
    
  environment:
    priv_key:
      secure: <privkeyvalue>

  install:
  - npm install grunt -g
  - npm install grunt-cli -g
  - ps: $fileContent = "-----BEGIN RSA PRIVATE KEY-----`n"
  - ps: $fileContent += $env:priv_key.Replace(' ', "`n")
  - ps: $fileContent += "`n-----END RSA PRIVATE KEY-----`n"
  - ps: Set-Content c:\users\appveyor\.ssh\id_rsa $fileContent
  - mkdir C:\projects\frontend
  - git clone -q --branch=master <frontendgitrepository> C:\projects\frontend
  - cd C:\projects\frontend
  - git checkout -qf master
  - cd C:\projects\backend

  configuration: Debug
  version: 1.0.{build}-{branch}
  
  before_deploy:
  - ps: if(-not $env:APPVEYOR_PULL_REQUEST_NUMBER) { $env:is_not_pr = "true"; }

  deploy:
    provider: Environment
    name: Development
    on: 
      is_not_pr: true

- # default
 ...

I have also tried to add the environment variable that is missing to the default config for all other branches except master, to no avail.
Am I missing something?

  1. Support Staff 1 Posted by Feodor Fitsner on 13 Apr, 2015 01:26 PM

    Feodor Fitsner's Avatar

    By default, secure variables are not decrypted on pull request builds, but if it's private repository you can allow that - there is Enable secure variables in Pull Requests option on General tab of project settings.

  2. 2 Posted by Rainer Ziller on 15 Apr, 2015 12:37 PM

    Rainer Ziller's Avatar

    Great, thank you, this is exactly it. :)

    Yes, this is a private repository.

  3. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:55 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac