-
Notifications
You must be signed in to change notification settings - Fork 86
Description
Describe the bug
I will preface this by saying this could be a GitLab pipeline issue, however, I have also seen this happen on a local development machine.
Command:
dotnet eb deploy-environment --application $EB_APPLICATION_NAME --environment $EB_ENVIRONMENT_NAME --version-label $CI_COMMIT_SHA-$CI_JOB_STARTED_AT --self-contained true --region $AWS_DEFAULT_REGION
GitLab script:
api_deploy_job:
stage: deploy
image: mcr.microsoft.com/dotnet/sdk:7.0
only:
- develop
script:
- echo $CI_COMMIT_SHA
- echo $AWS_DEFAULT_REGION
- apt-get update && apt-get install -y unzip
- apt-get install -y zip
- apt-get update
- apt-get install -y awscli
- dotnet --version
- aws --version
- dotnet tool install -g Amazon.ElasticBeanstalk.Tools
- export PATH="$PATH:/root/.dotnet/tools"
- cd HP.Api
- dotnet eb deploy-environment --application $EB_APPLICATION_NAME --environment $EB_ENVIRONMENT_NAME --version-label $CI_COMMIT_SHA-$CI_JOB_STARTED_AT --self-contained true --region $AWS_DEFAULT_REGION
The script initiates the dotnet publish command:
dotnet publish "/builds/hp-services/HP.Api" --output "/builds/hp-services/HP.Api/bin/Release/net7.0/publish" --configuration "Release" --framework "net7.0" --runtime linux-x64 --self-contained true
After the publish
compiles the project and creates the files, the Procfile
is auto-generated. The issue is the Procfile
is not setting the proper startup web
assembly.
Expected Behavior
Running the same command on a local environment produces this Procfile:
Current Behavior
The auto-generated Procfile
is pointing to the wrong assembly. It's not always the same assembly either, but it never picks the API assembly. Even when the Procfile
is created manually, it still does not deploy properly.
Reproduction Steps
I'm not 100% sure what might be going on, but I have a Minimal API that is also referencing an MS Test project. I'm not sure that is the issue since I can run the commands locally without issue. It could be the docker image used for the deployment.
I have another minimal API project that deploys fine in GitLab and locally. This project has no references to any other projects.
Possible Solution
I tried creating a Procfile
that is set to Copy Always
in the root of the API project. This does not work locally or in the pipeline.
Contents of the Procfile
web: ./HP.Api
This is in the logs, which makes sense:
However, the instance does not deploy properly:
Additional Information/Context
No response
Targeted .NET platform
.Net 7
CLI extension version
AWS CLI:
aws-cli/1.19.1 Python/3.9.2 Linux/5.4.109+ botocore/1.20.0
Donet EB:
dotnet-eb Tool 'amazon.elasticbeanstalk.tools' (version '4.3.2') was successfully installed
GitLab Runner:
Running with gitlab-runner 16.1.0~beta.59.g83c66823 (83c66823)
on blue-3.saas-linux-small-amd64.runners-manager.gitlab.com/default zxwgkjAP, system ID: s_d5d3abbdfd0a
feature flags: FF_USE_IMPROVED_URL_MASKING:true
Preparing the "docker+machine" executor
Using Docker executor with image mcr.microsoft.com/dotnet/sdk:7.0 ...
Pulling docker image mcr.microsoft.com/dotnet/sdk:7.0 ...
Environment details (OS name and version, etc.)
linux