Windows CodeDeploy - deploy to different destinations based on deployment group

0

I would like to know if it is possible to deploy your artifacts to different folders in a Windows server based on the deployment group name?

We have a deployment application for EC2/ On prem deployment and we would like to deploy the same artifacts to different folders in different deployment groups.

질문됨 일 년 전299회 조회
1개 답변
0
수락된 답변

I've figured out that we can use AfterInstall for this Install will copy the artifacts to a common folder The AfterInstall script can then read "DEPLOYMENT_GROUP_NAME" environment variable in a script to copy files from the common folder to the respective directory

Example "AfterInstall" script file for Windows here:

@echo off

setlocal

REM Set source and destination directories based on DEPLOYMENT_GROUP_NAME
set "source_dir=c:\web\codedeploy"

if "%DEPLOYMENT_GROUP_NAME%"=="staging" (
    set "dest_dir=C:\web\staging-app\"
) else (
   set "dest_dir=C:\web\prod-app\"
)

REM Copy files from source directory to destination directory
xcopy /s /e /y "%source_dir%" "%dest_dir%"

echo "Files copied successfully!"
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠