I have an Asp.Net MVC project that deploys to an Azure App Service via AppVeyor, with an appveyor.yml file that is configured to deploy GitHub commits to both Production and Staging.
The configuration is -
Master branch, use Release configuration.
Staging branch, use Staging configuration.
The staging deployment builds and deploys without issue, however, the staging deployment still targets the "Release" configuration, despite it being set to "Staging" for the Staging branch. I can see this as when I login to staging, it is pointing at the Staging Azure SQL database.
Local Testing
I have tested it locally in Staging configuration, and it works in that regard.
I'm assuming the appveyor.yml file is configured incorrectly, and thus AppVeyor is not picking up the Staging configuration?
version: 1.0.{build}
build_script:
- ps: .\build.cmd CreateNuGet
nuget:
account_feed: true
artifacts:
- path: output\*.*
test: off
for:
# configuration for "master" branch
# build in Release mode and deploy to the Azure prod environment
-
branches:
only:
- master
configuration: Release
deploy:
provider: WebDeploy
server: [removed for brevity]
website: [removed for brevity]
username: [removed for brevity]
password: [removed for brevity]
ntlm: false
remove_files: true
app_offline: false
# configuration for "staging" branch
# build in Staging mode and deploy to the Azure staging environment
-
branches:
only:
- staging
configuration: Staging
deploy:
provider: WebDeploy
server: [removed for brevity]
website: [removed for brevity]
username: [removed for brevity]
password: [removed for brevity]
ntlm: false
remove_files: true
app_offline: false
# "fall back" configuration for all other branches
# no "branches" section defined
# do not deploy at all
configuration: Debug
I suspect the "fall back" configuration is overriding the previously set configuration. By removing this (or possibly moving it to the top of the file) you will achieve the desired outcome.
Related
I am trying to log the reports from the build and publish it through the github releases by setting it as a draft releases.
Tried publishing the reports using the travis provider releases. Followed travis doc https://docs.travis-ci.com/user/deployment/releases/#draft-releases-with-draft-true
deploy:
- provider: releases
api_key: $GITHUB_TOKEM <I have set it as environment variable>
file: build.doc
skip_cleanup: true
draft: true
Getting this messaged from the travis log
Skipping a deployment with the releases provider because this branch is not permitted: suresh_branch
Is there any way to specify which git branch code to be deployed to an Elastic Beanstalk environment?
Assume, I have two git branches named test and stage and I have an Elastic Beanstalk environment named test-env.
Now, I set the branch defaults in config.yml as below:
branch-defaults:
test:
environment: test-env
group_suffix: null
global:
application_name: test
default_ec2_keyname: abcde
default_platform: Ruby 2.2 (Puma)
default_region: us-west-2
profile: eb-cli
sc: git
Now, what I need is if I deploy from stage branch with eb deploy test-env it should automatically deploy the code from test branch or it should throw an error..
Is there any way to do it. If no please suggest me some other way to do it..
Thanks..
This isn't something that the EB CLI supports; it will always run a deployment from the current branch. However, it's certainly something you can script (I'm assuming you're running under bash, it wouldn't be too hard to port to Windows command shell using the for command to extract the current branch name):
deployTest.sh:
#!bin/bash
# Grab the current branch name
current=`git rev-parse --abbrev-ref HEAD`
# Just in case we have any in-flight work, stash it
git stash
# Switch to 'test' branch
git checkout test
# Deploy to test-env
eb deploy test-env
# Switch back to whatever branchwe were on
git checkout $current
# Restore in-flight work
git stash pop
I've got a Lektor site that I'm trying to deploy automatically in response to pull requests and commits, using the Travis CI trigger approach from the Lektor docs.
The Lektor configuration works fine from the command line.
The Travis build starts, and appears to build the site without problem - but when it gets to deployment, the log says the following:
Installing deploy dependencies
!!! Script support is experimental !!!
Preparing deploy
Cleaning up git repository with `git stash --all`. If you need build artifacts for deployment, set `deploy.skip_cleanup: true`. See https://docs.travis-ci.com/user/deployment/#Uploading-Files.
No local changes to save
Deploying application
Deploying to ghpages-https
Build cache: /home/travis/.cache/lektor/builds/d3a411e13041731555222b901cff4248
Target: ghpages+https://pybee/pybee.github.io?cname=pybee.org
Initialized empty Git repository in /home/travis/build/pybee/pybee.github.io/temp/.deploytemp9xhRDc/scratch/.git/
Fetching origin
fatal: repository 'https://github.com/pybee/pybee.github.io/' not found
error: Could not fetch origin
fatal: repository 'https://github.com/pybee/pybee.github.io/' not found
Done!
For a full log, see here.
I've checked the credentials in the Travis CI configuration for the repository; I'm as certain as I can be that they're correct. I've tried using the same configuration (exporting LEKTOR_DEPLOY_USERNAME and LEKTOR_DEPLOY_PASSWORD locally), and it works fine.
hammer:pybee.org rkm$ lektor deploy ghpages-https
Deploying to ghpages-https
Build cache: /Users/rkm/Library/Caches/Lektor/builds/a269cf944d4302f15f78a1dfb1602486
Target: ghpages+https://pybee/pybee.github.io?cname=pybee.org
Initialized empty Git repository in /Users/rkm/projects/beeware/pybee.org/temp/.deploytempOh4p98/scratch/.git/
Fetching origin
From https://github.com/pybee/pybee.github.io
* [new branch] master -> origin/master
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
Everything up-to-date
Done!
Any suggestions on the cause of this error?
It turns out this is a bug in Lektor.
If you use the following in your <project>.lektorproject:
[servers.ghpages-https]
target = ghpages+https://pybee/pybee.github.io?cname=pybee.org
and the following in your .travis.yml:
language: python
python: 2.7
cache:
directories:
- $HOME/.cache/pip
- $HOME/.cache/lektor/builds
install: "pip install git+https://github.com/singingwolfboy/lektor.git#fix-ghpages-https-deploy#egg=lektor"
script: "lektor build"
deploy:
provider: script
script: "lektor deploy ghpages-https"
on:
branch: lektor
(i.e., use the PR branch for deployment), builds will deploy as expected.
I'm thinking of how to setup continuous integration and deployment using bitbucket, drone.io, hub.docker.com and swarm(aws ec2) cluster?
I submit code to bitbucket
bitbucket's web hook triggers drone.io and it builds and runs tests
On every "green" commit, docker image is pushed to the hub.docker.com and deployed to integration environment (swarm cluster) using "latest" label.
I can't figure it out how to setup step 3 ...
As an example, add to your .drone.yml:
publish:
docker:
username: octocat
password: password
email: octocat#github.com
repo: octocat/hello-world
tag: latest
when:
success: true
deploy:
webhook:
urls:
- https://your.webhook/...
header:
Authorization: pa55word
X-Docker-Image: name_of_your_image:latest
when:
success: true
This would perform the publish step using the docker plugin, followed by hitting a URL endpoint to deploy the published image to your integration environment using the webhook plugin.
I'm looking to declare environment variables in my Travis CI repository settings and use them in my .travis.yml file to deploy an application and post a build notification in Slack.
I've set environment variables in my Travis CI repository settings like so:
My .travis.yml file appears as the following:
language: node_js
node_js:
- '0.12'
cache:
directories:
- node_modules
deploy:
edge: true
provider: cloudfoundry
api: $CF_API
username: $CF_USERNAME
password: $CF_PASSWORD
organization: $CF_ORGANIZATION
space: $CF_SPACE
notifications:
slack: $NOTIFICATIONS_SLACK
When I add the values into the .travis.yml file as they are, everything works as planned.
However, when I try to refer to the environment variables set in the repository, I receive no Slack notification on a build status, and the deployment fails.
Am I following this process correctly or is there something I'm overseeing?
I think it is probably too early in Travis CI's sequence for your environment variables to be read.
What I would suggest is to rather encrypt them using the travis command-line tool.
E.g.
$ travis encrypt
Reading from stdin, press Ctrl+D when done
username
Please add the following to your .travis.yml file:
secure: "TD955qR6qvpVIz3fLkGeeUhV76deeVRaLVYjW9YjV6Ob7wd+vPtACZ..."
Pro Tip: You can add it automatically by running with --add.
Then I would copy/paste the secure: "TD955qR6qvpVIz3fLkGeeUhV76d..." result at the appropriate place in your .travis.yml file:
language: node_js
node_js:
- '0.12'
cache:
directories:
- node_modules
deploy:
edge: true
provider: cloudfoundry
api:
secure: "bHU4+ZDFeZcHpuE/WRpgMBcxr8l..."
username:
secure: "TD955qR6qvpVIz3fLkGeeUhV76d..."
You can have more details about how to encrypt sensitive data on Travis CI here.
Hope this helps.