I am trying to deploy my web app using the GitLab pipeline to VMware but it keeps throwing me a 403 Forbidden error but it deploys perfectly fine when I use the The Cloud Foundry command-line interface (cf CLI). 403 Forbidden Error
The deployment succeeds but there are error when accessing the deployed website
This is the script of the deploy job after running it through the CI Lint
cf api $NP_PCF_URL
cf auth $CF_NONPROD_USERNAME $CF_NONPROD_PASSWORD
cf target -o $ORG -s $SPACE
$PRE_DEPLOY_CMD
cf push $APP_NAME -p $TARGET -f $PCF_MF_FILE --no-start
$POST_DEPLOY_SCRIPT
cf set-env $APP_NAME CI_BUILD_ID $CI_PIPELINE_ID
cf set-env $APP_NAME CI_JOB_ID $CI_JOB_ID
cf set-env $APP_NAME CI_REPOSITORY_URL $CI_REPOSITORY_URL
cf set-env $APP_NAME CI_PROJECT_NAME $CI_PROJECT_NAME
cf set-env $APP_NAME GITLAB_USER_LOGIN $GITLAB_USER_LOGIN
cf set-env $APP_NAME GITLAB_USER_EMAIL $GITLAB_USER_EMAIL
cf set-env $APP_NAME DEPLOY_DATE $(date --utc -Iseconds)
deployStatus=$(cf start $APP_NAME | grep 'requested state')
echo $deployStatus
cf logs $APP_NAME --recent > log-output.txt
if [[ $deployStatus != *"started"* ]]; then echo "Deployment is not Succeeded"; exit 1; else echo "Deployment Successful"; fi
cf logout
Found out that the index.html and other files are not copied into the artifact. Used a script to manually copy those necessary files and move it to the assigned folder.
mkdir $NESTED_TARGET
cp index.css index.html $TARGET
echo "Moving build files into dist folder"
mv dist/build.js $NESTED_TARGET
mv dist/build.js.map $NESTED_TARGET