Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create backend and frontend code locally to do amplify manual CI/CD with GHES repo #919

Open
1 of 2 tasks
sesa575445 opened this issue Dec 19, 2024 · 5 comments
Open
1 of 2 tasks
Labels
pending-response pending-triage Issues that need further discussion to determine

Comments

@sesa575445
Copy link

Describe the feature you'd like to request

Hi Team,
Hope this message finds you well.
In our office project, we are trying to migrate our amplify codebase from github.com to ghes (our internal GHES instance). In the process, I have gone through the process attached in the given text file to:

  1. Build Frontend build.zip file and upload to S3 to run (with aws amplify create-deployment and aws amplify start-deployment)
  2. Build Backend artifact (Current cloud backend with cloud formation template json) and upload amplify-builds/ to our custom S3 deployment bucket.
    Frontend build.zip was successful.
    But the 2nd point, I have tried the following:
    I am not using github for amplify to build itself. I want to compile backend locally of my local amplify/backend/ and produce new amplify-builds/ and upload to s3 with aws amplify create-backend commmand line.

Error:
#####################################################################################################
I have run below command to build backend api,functions code under amplify/backend/awscloudformation/build.
#####################################################################################################
1.amplify push --codegen
Error: Not able to find backend environment.

2.Try, amplify pull --appId d173tjf92bxxxx --envName testmig
Error: × There was an error initializing your environment.
🛑 Could not find a deployment bucket for the specified backend environment. This environment may have been deleted.
Resolution: Make sure the environment has been initialized with "amplify init" or "amplify env add".

3.amplify add env testmig
Note: It is recommended to run this command from the root of your app directory
Using default provider awscloudformation

  • Initializing your environment: testmig
    × Initializing your environment: testmig
    × There was an error initializing your environment.
    🛑 Could not initialize platform for 'testmig': The specified key does not exist.

It seems like the error "The specified s3 key does not exist" is still persisting. I have all the meta data properly written in team-provider-info.json to determine where to push the build artifacts and how to configure the backend environment.
Updating team-provider-info.json:

Please advise as it is critical for us to move our amplify code from github.com to internal GHES.
Thanks,
Sriram
amplify_push_codegen_keydoesn't_exit.txt

Describe the solution you'd like

I want the following to be done gracefully without errors.

  1. Compile Backend Locally:

    • Run amplify push --codegen to compile the backend and generate the necessary build artifacts.
  2. Prepare Deployment Artifacts:

    • Copy the contents of amplify/#current-cloud-backend/ to a new directory:
      cp -r amplify/#current-cloud-backend/ amplify-builds/
  3. Upload Artifacts to S3:

    • Create an S3 bucket if needed:
      aws s3 mb s3://your-deployment-bucket-name
    • Sync the amplify-builds/ directory with your S3 bucket:
      aws s3 sync amplify-builds/ s3://your-deployment-bucket-name/amplify-builds/
  4. Create Backend Environment Using AWS CLI:

    • Use the aws amplify create-backend-environment command to create the backend environment:
      aws amplify create-backend-environment \
          --app-id <your-app-id> \
          --environment-name testmig \
          --stack-name <your-stack-name> \
          --deployment-artifacts s3://your-deployment-bucket-name/amplify-builds/

Describe alternatives you've considered

I haven't received not much inputs from amplify issues in github.com

Additional context

No response

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request

Would this feature include a breaking change?

  • ⚠️ This feature might incur a breaking change
@sesa575445 sesa575445 added the pending-triage Issues that need further discussion to determine label Dec 19, 2024
@sesa575445
Copy link
Author

Hi Team,
Kindly respond to this ticket as - Can be done or Can't be done.
I forgot to mention one thing: I have copied an existing github.com/dev amplify environment our github.myorg.com, altered to team-provider-info.json with the new amplify app Id I have created without any repo/branch link from github.com in an attempt to push the new branch-name, new env-name, new-deployment-bucket name everything with "aws amplify <>" manual CI/CD command line.
Thanks,
Sriram

@sesa575445
Copy link
Author

Hi Team
Please respond to our request. It is critical for our company to move all the projects from github.com to GHES.
Thanks,
Sriram

1 similar comment
@sesa575445
Copy link
Author

Hi Team
Please respond to our request. It is critical for our company to move all the projects from github.com to GHES.
Thanks,
Sriram

@AnilMaktala
Copy link
Member

Hey @sesa575445 , Thanks for raising this. We would like to do a deepdive into the issue, can you please your availability for share?

@sesa575445
Copy link
Author

Hi 👋 @AnilMaktala
Thanks for responding finally 🙏 Yes I am available in the India Timezone from 11 AM till 7 PM as I am based in Bangalore.
Please let me know so that we can meet up on a call today that is Thursday night IST at 6 PM or 7 PM.
Cheers,
Sriram

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-response pending-triage Issues that need further discussion to determine
Projects
None yet
Development

No branches or pull requests

2 participants