Among IT projects, Agile and DevOps are gaining ground at a rate we’ve never seen before! The number of procedures and tools that allow for the creation of better software grows as a result of the growing interest in these topics.
“Delivery” refers to the final phase of software development. There is a risk that the entire agile development approach could be ruined if the delivery is too slow. It is imperative that modern software be built to be delivered quickly, utilizing the right automation technologies. I’ll talk about Google Cloud Platform’s Continuous Delivery in this context.
Using GCP’s App Engine serverless application platform, I’ll demonstrate how to set up a development pipeline that includes an automated build process as well as continuous delivery. To keep things simple, we’ll build a front-end application in App Engine Standard Environment and deploy it there.
Please keep in mind that our primary focus will be on delivering the product, not on app development.
If you want to execute the examples, you must first establish a GCP Project and install the Google Cloud SDK on your computer.
Don’t forget to run gcloud auth login and gcloud config set project <your-project-id> for proper gcloud CLI usage.
Angular CLI is an easy approach to building a front-end web application. It is beyond the scope of this post to discuss how to install this tool.
Cd into your selected folder and put in ng new app-name> after the app has been installed. Wait a few moments. As soon as the app is created, type cd and serve the app. make sure the app is operating by going to http://localhost: and checking the status of the app. We’re stopping development here because we already have a working app. You need to start thinking about delivery!
Apps built with the framework are made of HTML, CSS, JS, and other static files. When the app is ready, we’ll put it up on a public HTTP server and let the public use it. npm install and npm run build —prod is used to build the Angular app in the <app-name> folder. A new dist folder is created, where the ready-to-deploy content is stored. Don’t you think that by taking this route, we’re increasing the amount of time and effort required to construct our software? We’ll learn how to use Cloud Build because we prefer simplicity and automation over complexity and manual tasks.
You can build software fast across all languages with Cloud Build, which is a fully-managed service on Google Cloud Platform that relies on containers. Now that we’ve established that, let’s go to work on getting our project ready for Cloud Build.
Your project’s root folder should contain a file called cloudbuild.yaml, with the following content:
Similar to a Docker multistage build, Cloud Develop uses this simple file to build and deploy the app. As soon as gcloud builds submit —config cloudbuild.yaml is run, the project’s source files are compressed and copied to an administrator-managed Cloud Storage Bucket (files listed in the.gitignore file will be skipped). It occurs on your developer machine.
When Cloud Build is running on GCP servers, it will uncompress the sources and perform npm install in a container with the built-in image gcr.io/cloud-builders/npm. In the next phase npm run build —prod will be executed in a separate npm container? gcr.io/cloud-builders/gcloud is a built-in image in Cloud Build that will be used to run a gcloud app deploy command.
This is the third phase, and I’ve already covered the first two. Let me take care of it. This command completes the delivery process by deploying the developed content to App Engine. App.yaml in the project’s root folder (see sample content below) is required, as is an account with the project number <your-project-number> cloudbuild.gserviceaccount.com. Admin API access must be granted to the GCP Project in which the app will be deployed, and the Service Account must have access to the App Engine Admin role.
If you’ve already produced a file, you can simply copy it to GAE Python 2.7 Standard Environment, where it will be provided as static content.
Make sure to visit https://appspot.com/app/index.html to see the app running on Google’s App Engine! You may also see your project’s build history at https://console.cloud.google.com/cloud-build/builds?project=your-project-id>.
The interplay between Cloud Build, Cloud Storage, and App Engine is well-understood, but Source Repositories remain a mystery.
The source control management tool Git is becoming increasingly popular. You can utilize GCP as a remote repository for Git or automatically mirror repositories from Github or Bitbucket using Source Repositories.
Go to https://console.cloud.google.com/Cloud-Build/triggers?project=[your project id] to set up Cloud Build triggers. A trigger source and repository are selected when you click on “ADD TRIGGER.” Let’s call it the “trigger.” The build configuration is cloudbuild. yaml. Push to master branch, select Branch as Trigger type, and type master as the Branch (regex). Save the cloudbuild.yaml location by typing /cloudbuild.yaml. When a new commit to master is made, the build process begins automatically. In order to start the build, we no longer need to manually run gcloud builds submit.
It is possible to utilize or alter the methods outlined in this article in order to deploy any type of application supported by the App Engine Standard Environment of Google Cloud Platform. The structure of folders must be altered in order to deploy to a Flexible Environment.