awslabs / app-development-for-backstage-io-on-aws

A developer portal to meet your Enterprise needs. Fast, secure, and at-scale.
https://opaonaws.io/
Apache License 2.0
158 stars 28 forks source link

Email cannot be blank and must be a valid email #81

Closed gvasquez95 closed 3 months ago

gvasquez95 commented 3 months ago

Description

Configuration phase during installation fails, getting trapped in an endless loop about invalid/missing email. Valid/existing email address has been provided in line 73 of config/.env file under environment variable BACKSTAGE_SCAFFOLDER_EMAIL

Environment:

OSX Version:
sw_vers -productVersion 
14.3.1

node --version
v18.17.1

cdk --version
2.90.0 (build 8c535e4)

yarn --version
1.22.22

Extra:

Versions

yarn list v1.22.22
├─ @aws/plugin-aws-apps-backend-for-backstage@0.3.2
├─ @aws/plugin-aws-apps-common-for-backstage@0.3.2
├─ @aws/plugin-aws-apps-demo-for-backstage@0.3.1
├─ @aws/plugin-aws-apps-for-backstage@0.3.2
└─ @aws/plugin-scaffolder-backend-aws-apps-for-backstage@0.3.2

Reproduction Code [Required]

make install

Steps to reproduce the behavior:

Expected behavior

Installation succeeded

Actual behavior

Trapped in loop

Terminal Output Screenshot(s)

Endless loop of:

email: Email cannot be blank and must be a valid email Please enter the email you'd like to use for this repository email: Email cannot be blank and must be a valid email Please enter the email you'd like to use for this repository email: Email cannot be blank and must be a valid email Please enter the email you'd like to use for this repository email: Email cannot be blank and must be a valid email Please enter the email you'd like to use for this repository email: Email cannot be blank and must be a valid email Please enter the email you'd like to use for this repository email: Email cannot be blank and must be a valid email Please enter the email you'd like to use for this repository email: Email cannot be blank and must be a valid email Please enter the email you'd like to use for this repository email: Email cannot be blank and must be a valid email Please enter the email you'd like to use for this repository

Additional context

gvasquez95 commented 3 months ago

I just found installation log files and the latest one shows this message just before entering the loop:

Should this be used for git defender? (y/N) Configure email allowed for commits
Existing email: user@mydomain.com
Should this be used for git defender? (y/N)

As N is the default option, that seems to be the issue. I'll try to install from a blank Cloud9 environment, instead of my local machine. Could this default be overriden, perhaps?

z-sourcecode commented 3 months ago

Hi @gvasquez95 Thanks for reaching out! Can you please comment out lines 56-63 from this file and try again? https://github.com/awslabs/app-development-for-backstage-io-on-aws/blob/8b1907352286fea7a617b76cb49c3aa3fe89847c/build-script/gitlab-tools.sh#L58

awsjim commented 3 months ago

This issues should only apply to users that have git-defender installed. A manual change you could make to workaround the git-defender "looping" behavior: In the gitlab-tools.sh file at line 56 (link), you can replace lines 56-63 with the following code:

IS_DEFENDER=$(type "git-defender" 2>/dev/null) || true
# if the system is using git-defender and the repo is not configured, configure it
if [[ ! -z "$IS_DEFENDER" ]] && ! grep -q "\[defender\]" .git/config ; then
  echo -e "\nGit Defender detected. Populating git-temp/backstage-reference/.git/config for Defender.\n"
  echo -e "" >> .git/config
  echo -e "[defender]" >> .git/config
  echo -e "\tallowrepo = https://$SSM_GITLAB_HOSTNAME/opa-admin/backstage-reference.git" >> .git/config
  echo -e "\tallowemail = $(whoami)@amazon.com" >> .git/config
  echo -e "\tregistered = true" >> .git/config
  echo -e "" >> .git/config
elif grep -q "\[defender\]" .git/config ; then
  echo -e "Git Defender has already been configured in git-temp/.git/config\n"
fi

A fix is being prepared to included in the next release

gvasquez95 commented 3 months ago

@awsjim the workaround worked perfectly, thanks