...
Warning |
---|
Remember: the 'main' branch is not pushable, each developer need to use branch and create a github Pull Request(PR) to merge desidere branches into main |
Project Overview
The cloned repository will have a structure like this:
...
Each component of the project's structure is designed to support its development, deployment, and documentation, ensuring a streamlined workflow for contributors.
Initial file content
here we are going to give an overview of the file that has been created for the startup project:
src/index.js
the index file
Code Block | ||
---|---|---|
| ||
const express = require("express");
const app = express();
const port = 3000;
app.get("/", (req, res) => {
res.send("Hello World!");
});
const server = app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`);
});
module.exports = { app, server }; // Export both app and server |
Initiating Application Development
With the preparatory steps completed, you are now ready to embark on the development of your application. To ensure a smooth and efficient workflow, it is recommended to adhere to the following guidelines:
Branch Creation:
- Begin by creating a new branch off the main branch or any other branch as appropriate for your new feature. Aim for a descriptive name for your branch, utilizing prefixes such as
feature/
,fix/
, orimprovement/
to provide clear context. The name of the branch will be incorporated into the PR (Pull Request) merge message and will be recorded in the source code history.
- Begin by creating a new branch off the main branch or any other branch as appropriate for your new feature. Aim for a descriptive name for your branch, utilizing prefixes such as
Commit and Push:
- Following each commit, push your changes to the main repository. This serves as a backup and facilitates collaboration.
Testing:
- It is imperative to include tests for your application. Testing ensures that as your application evolves, previously tested features continue to function correctly. Early detection of issues through testing is preferable to discovering them at a later stage. Put all your test into the test folder, will be automatically discovered and executed during the workflow.
Pull Request and Merge:
- Upon completing development, push your final commit and initiate a PR to merge your changes into the main branch. The process involves:
- The execution of a merge workflow upon PR creation or modification, which includes running all tests located in the test folder. Should any issues arise, the PR will be blocked until these are resolved. This workflow acts as a critical checkpoint.
- Once the workflow concludes successfully without errors, the PR is eligible for merging.
- Upon completing development, push your final commit and initiate a PR to merge your changes into the main branch. The process involves:
Deployment Workflow:
- Merging into the main branch triggers an automatic deployment workflow, comprising:
- A build and test phase akin to the PR workflow. Any problems encountered will halt progress.
- Upon successful completion of the previous step, a Docker image is created using the Dockerfile located at the root of the project. Should issues occur, the workflow is halted.
- The final step involves triggering a workflow in the deployment project, managed by the administrator, which includes:
- Automatic updating of the kubernetes test deployment configurations with the newly generated Docker image and subsequent deployment to the K8S test environment after a short delay.
- The workflow pauses, awaiting action from authorized personnel to initiate deployment to the K8S production environment.
- Merging into the main branch triggers an automatic deployment workflow, comprising:
Following these steps not only ensures a systematic approach to application development but also fosters a culture of testing and continuous integration, thereby enhancing the quality and reliability of your application. Upon completion, the cycle can recommence with the creation of a new branch for additional features, returning to the beginning of this guide.
Content by Label | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...