Is it possible to have multiple appveyor.yml configurations? - visual-studio

In our project repository we have an appveyor.yml which is setup for our .NET web applications (with things like assembly patching, nuget restore, etc.). If everything succeeds, our application is deployed to a staging and production environment. The .NET solution is located in repo/src/.
In the same repository we also create our HTML templates located in repo/frontend/. We would like to do a deploy of these HTML-files to a FTP host. This Frontend configuration should be run before the other configurations, but logically fails on assembly_info and nuget restore when no .NET solution is created.
Is it possible to create an appveyor configuration which can deploy our Frontend configuration to FTP and optionally continue with the Debug and Release configurations when a .NET solution is available?
Our configuration file this far:
version: 1.0.0.{build}
branches:
only:
- develop
- /release\/\d+.\d+.\d+/
- master
image: Visual Studio 2015
matrix:
fast_finish: true # set this flag to immediately finish build once one of the jobs fails.
allow_failures:
- platform: x86
configuration: Debug
- platform: x86
configuration: Release
assembly_info:
patch: true
file: AssemblyInfo.*
assembly_version: "{version}"
assembly_file_version: "{version}"
assembly_informational_version: "{version}"
nuget:
account_feed: true
configuration:
- Frontend
- Debug
- Release
build:
publish_wap: true
verbosity: minimal
before_build:
- cmd: nuget restore src\ProjectName.Web.sln
test: off
artifacts:
- path: frontend/dist/
name: frontenddist
deploy:
- provider: FTP
host: 0.0.0.0
protocol: ftp
username: username
password:
secure: password
folder: frontend-test
application: frontenddist
beta: true
on:
branch: develop
configuration: frontend
- provider: Environment
name: ProjectName.Development
remove_files: true
on:
branch: develop
configuration: debug
- provider: Environment
name: ProjectName.Production
remove_files: false
on:
branch: master
configuration: release
notifications:
- provider: Slack
incoming_webhook: # removed for stackoverflow example
on_build_success: true
on_build_failure: true
on_build_status_changed: false

Answer in AppVeyor forum discussion

Related

sh: 1: nest: Permission denied in GitHub Action

For some reason the build step for my NestJS project in my GitHub Action fails for a few days now. I use Turborepo with pnpm in a monorepo and try to run the build with turbo run build. This works flawlessly on my local machine, but somehow in GitHub it fails with sh: 1: nest: Permission denied. ELIFECYCLE  Command failed with exit code 126. I'm not sure how this is possible, since I couldn't find any meaningful change I made to the code in the meantime. It just stopped working unexpectedly. I actually think it is an issue with GH Actions, since it actually works in my local Docker build as well.
Has anyone else encountered this issue with NestJS in GH Actions?
This is my action yml:
name: Test, lint and build
on:
push:
jobs:
test-lint-build:
runs-on: ubuntu-latest
services:
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_HOST: localhost
POSTGRES_USER: test
POSTGRES_PASSWORD: docker
POSTGRES_DB: financing-database
ports:
# Maps tcp port 5432 on service container to the host
- 2345:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout#v3
- name: Install pnpm
uses: pnpm/action-setup#v2.2.2
with:
version: latest
- name: Install
run: pnpm i
- name: Lint
run: pnpm run lint
- name: Test
run: pnpm run test
- name: Build
run: pnpm run build
env:
VITE_SERVER_ENDPOINT: http://localhost:8000/api
- name: Test financing-server (e2e)
run: pnpm --filter #project/financing-server run test:e2e
I found out what was causing the problem. I was using node-linker = hoisted to mitigate some issues the pnpm way of linking modules was causing with my jest tests. Removing this from my project suddenly made the action work again.
I still don't know why this only broke the build recently, since I've had this option activated for some time now.

TeamCity Agent artifacts cache issue: agent accumulates artifacts from all prev builds

I have TeamCity setup in docker-compose.yml
version: "3"
services:
server:
image: jetbrains/teamcity-server:2021.1.2
ports:
- "8112:8111"
volumes:
- ./data_dir:/data/teamcity_server/datadir
- ./log_dir:/opt/teamcity/logs
db:
image: mysql
ports:
- "3306:3306"
volumes:
- ./mysql:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=111
- MYSQL_DATABASE=teamcity
teamcity-agent-1:
image: jetbrains/teamcity-agent:2021.1.2-linux-sudo
environment:
- SERVER_URL=http://server:8111
- AGENT_NAME=docker-agent-1
- DOCKER_IN_DOCKER=start
privileged: true
container_name: docker_agent_1
ipc: host
shm_size: 1024M
teamcity-agent-2:
image: jetbrains/teamcity-agent:2021.1.2-linux-sudo
environment:
- SERVER_URL=http://server:8111
- AGENT_NAME=docker-agent-2
- DOCKER_IN_DOCKER=start
privileged: true
container_name: docker_agent_2
ipc: host
shm_size: 1024M
teamcity-agent-3:
image: jetbrains/teamcity-agent:2021.1.2-linux-sudo
environment:
- SERVER_URL=http://server:8111
- AGENT_NAME=docker-agent-3
- DOCKER_IN_DOCKER=start
privileged: true
container_name: docker_agent_3
ipc: host
shm_size: 1024M
and I have E2E tests which I run in teamcity agents. As a result of tests execution they generate HTML report and in case tests are failed they generate video report as well. Everything working as expected locally without TeamCity. When I move it to TeamCity I setup to keep folder "reports" in artifacts. And I have the following behaviour in fact:
HTML reports are coming everytime updated
videos keep growing from build to build. I generate diff path with timestamp for folder name and for video names to avoid cache. If 1 test was failed and generated 1 video this video will come to artifacts of all next builds even they are passing and video folder should be empty
My question described exactly in jetbrains support in 2014
https://teamcity-support.jetbrains.com/hc/en-us/community/posts/206845765-Build-Agent-Artifacts-Cache-Cleanup
but I tried diff settings from there and there is no luck unfortunatelly
What I tried myself and what did not help:
tried to clean \system. artifacts_cache folder. Artifacts are still growing
tried to find a config for agent
in /data/teamcity_agent/conf/buildAgent.properties I place 2 new settings
teamcity.agent.filecache.publishing.disabled=true
teamcity.agent.filecache.size.limit.bytes=1
after agent restarting I see those 2 new settings in TeamCity webinterface which means that settings were applied
but behaviour is still the same. Maybe other settings should be used but I did not manage to find
what helps is pressing "Clean sources on this agent" in agent settings but press by hands it is not the way
It looks like a cache issue cause if I assign another agent accumulation starts from the beginning.
any suggestions are appeciated
Seems like I found an answer
https://www.jetbrains.com/help/teamcity/2021.1/clean-checkout.html#Automatic+Clean+Checkout
"Clean all files before build" option should be selected on the Create/Edit Build Configuration > Version Control Settings page

Travis doesn't deploy on heroku. Invalid credentials

I'm trying to set up automatic deploy on heroku with travis. I get this error when travis try to deploy:
API request failed.
Message: Invalid credentials provided.
Reference:
failed to deploy
This is my travis file:
jobs:
include:
- language: python
python:
- "3.6"
install:
- pip install -r Deployment/requirements.txt
script:
- python -c "print ('Testing some script')"
branches:
only:
- master
- develop
before_deploy:
- cd Deployment
deploy:
- provider: heroku
skip_cleanup: true
api_key:
secure: b3AVdCtJ2e/+Gu1...
app:
master: motorent-deploy
develop: motorent-apitest
- language: android
dist: trusty
env:
global:
- ANDROID_API_LEVEL=29
- ANDROID_BUILD_TOOLS_VERSION=29.0.3
- extra-google-google_play_services
- extra-google-m2repository
- extra-android-m2repository
- addon-google_apis-google-$ANDROID_API_LEVEL
android:
licenses:
- 'android-sdk-preview-license-.+'
- 'android-sdk-license-.+'
- 'google-gdk-license-.+'
components:
- tools
- platform-tools
- android-$ANDROID_API_LEVEL
- build-tools-$ANDROID_BUILD_TOOLS_VERSION
- extra-google-google_play_services
- extra-google-m2repository
- extra-android-m2repository
- addon-google_apis-google-$ANDROID_API_LEVEL
addons:
apt:
packages:
ant
before_install:
- touch $HOME/.android/repositories.cfg
- yes | sdkmanager "platforms;android-29"
- yes | sdkmanager "build-tools;29.0.3"
before_script:
- cd AndroidApp
- chmod +x gradlew
script:
- ./gradlew build check
As you can see I have two differents projects in the same repository, but it's not important, because the android test works well. What doesn't work is the deploy of Flask project. The solutions that I have found talk about the need to encrypt the api_key. I have tested it with Travis encrypt $(heroku auth:token) but it doesn't work either.
I've been trying to find the error for a long time but I don't know what it can be.
I had the same error.
Here are steps that I performed to fix it.
Firstly I tried the command: heroku auth:token
but the output was:
› Warning: token will expire 06/06/2021
› Use heroku authorizations:create to generate a long-term token
Then I tried the command: heroku authorizations:create
One line from the output contained Token: <created_heroku_auth_token>
I took the value of it (<created_heroku_auth_token>)
and I went to
https://travis-ci.org/github/<my_github_user>/<my_repo>/settings
where I created new environment variable:
HEROKU_AUTH_TOKEN with value of my <created_heroku_auth_token>
Then in my .travis.yml I changed value of api_key to:
api_key: $HEROKU_AUTH_TOKEN
After pushing this change, the deployment to heroku went fine.

Travis-Ci after_deploy script is not working, and displaying success

This my .travis.yml file. I am trying to automate deployment to aws-codedeploy.
language: node_js
node_js:
- 7.10.0
services:
- mongodb
env:
- PORT=6655 IP="localhost" NODE_ENV="test"
script:
- npm start &
- sleep 25
- npm test
deploy:
provider: codedeploy
access_key_id:
secure: $Access_Key_Id
secret_access_key:
secure: $Access_Key_Secret
revision_type: github
application: Blog
deployment_group: Ayush-Bahuguna
region: us-east-2
after_deploy:
- "./build.sh"
Here build.sh is a shell script that generates the build files
cd /var/www/cms
sudo yarn install
npm run build-prod
And here is .gitignore file
node_modules/
client/dashboard/dist/
client/blog/dist/
The issue is that, even though travis-ci build succeeds, and after_deploy runs successfully, no build files are generated on the aws ec2 instance where my project is hosted.
Are you able to see any deployment created on your AWS CodeDeploy console? And are your able to see the deployment status? If there is a deployment created, but failed, you can try to see the reason why it failed. Even though the deployment succeeded, it doesn't equal to all instances are deployed depends on the deployment configuration: http://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-configurations.html.
Thanks,
Binbin

Different before_deploy for each provider on TravisCI

I currently have a Github repo with two folders, backend and frontend. In each folders there's an app I need to deploy to a given provider. I'm using TravisCI to auto-deploy.
I'd like to be able to do different before_deploy steps for each provider. Is there a way to do that with TravisCI?
Here's what my .travis.yml looks like so far:
language: java
jdk:
- oraclejdk8
before_install:
- cd backend
before_deploy:
- cd backend
deploy:
- provider: cloudcontrol
email: "CLOUDCONTROL EMAIL"
password: "CLOUDCONTROL PASSWORD"
deployment: "APP_NAME/DEP_NAME"
- provider: heroku
api_key:
secure: "My_API_KEY"
app: MYAPP

Resources