Skip to content

automations and artifact generation

Shelson Ferrari edited this page Jul 23, 2024 · 5 revisions

Automations and Artifact Generation

The CI/CD pipeline for the Currency Conversion API includes various automations to streamline the development process and ensure consistency. Below are the key automations and artifact generation steps included in the pipeline.

PlantUML Diagrams

PlantUML diagrams are generated automatically as part of the CI/CD process. The diagrams are rendered and committed to the repository to keep the documentation up-to-date.

Documentation Generation

The pipeline generates several documentation files, including CHANGELOG.md, .env, DIRECTORY.md, swagger.json, swagger.yaml, and Java documentation in Markdown format. These files are automatically updated and committed to the repository if there are changes.

Maven Package Caching

Maven dependencies are cached to speed up the build process. The cache is created based on the pom.xml file, and the dependencies are restored from the cache if available.

Python Script for Markdown Table Adjustment

A Python script is used to adjust the Markdown table in the generated documentation. This ensures the table format is correct and consistent.

Artifact Upload

The pipeline includes steps to upload various artifacts to the repository if they have changed. This includes documentation files and PlantUML diagrams.

Cleanup

The local Maven repository is cleaned up as part of the pipeline to free up space and ensure a clean build environment.

Example Artifacts

CHANGELOG.md

The CHANGELOG.md file is automatically updated with the latest changes based on commit messages.

.env

The .env file is updated with the latest environment variables required for the project.

DIRECTORY.md

The DIRECTORY.md file is generated to provide an overview of the project directory structure.

swagger.json and swagger.yaml

The swagger.json and swagger.yaml files are generated to provide OpenAPI specifications for the API.

Java Documentation in Markdown

The Java documentation is generated in Markdown format using the Dokka plugin. This documentation is committed to the docs/site directory.

Example Python Script for Markdown Table Adjustment

import re
import os

def adjust_markdown_table(input_file, output_file):
    with open(input_file, 'r', encoding='utf-8') as file:
        lines = file.readlines()

    table_start = False
    adjusted_lines = []
    for line in lines:
        if '| Name |' in line:
            adjusted_lines.append('| Name | Description |\n')
            adjusted_lines.append('|---|---|\n')
            table_start = True
        elif table_start and '|---|' in line:
            continue
        elif table_start:
            match = re.match(r'\|\s*\[(.*)\]\((.*)\)\s*\|\s*(.*)\|?', line)
            if match:
                name = match.group(1)
                link = match.group(2)
                description = match.group(3).strip() if match.group(3) else ''
                adjusted_line = f"| [{name}]({link}) | {description} |\n"
                adjusted_lines.append(adjusted_line)
            else:
                if line.strip() == '':
                    table_start = False
                adjusted_lines.append(line)
        else:
            adjusted_lines.append(line)

    with open(output_file, 'w', encoding='utf-8') as file:
        file.writelines(adjusted_lines)
    print(f"Markdown table adjusted and saved to {output_file}")

docs_path = 'docs/site'
input_md = os.path.join(docs_path, 'index.md')
temp_md = os.path.join(docs_path, 'index2.md')

os.rename(input_md, temp_md)
print(f"Renamed {input_md} to {temp_md}")

adjust_markdown_table(temp_md, input_md)

os.remove(temp_md)
print(f"Deleted temporary file {temp_md}")

Wiki Menu

Wiki Main Page

1. Introduction to the Project

  • Overview: Presentation of the project, highlighting its purpose and the context in which it is embedded.
  • Project Objectives: Enumeration of the main objectives that the project aims to achieve.
  • Scope and Functionalities: Description of the main functionalities offered by the project and its scope of operation.

2. Configuration and Installation

3. Project Structure

  • Folder Structure: Description of the organization of the project directories.
  • Project Architecture: Explanation of the architecture used, including design patterns and technical decisions.

4. Development

  • Development Flow: Description of the development process adopted, including planning, coding, and review stages.
  • Apache Camel Integration: Guide on integrating Apache Camel into the project, including configuration and usage.
  • Contributors and Authors: Recognition of the contributors to the project.
  • Contributions: Guidelines on how to contribute to the project, including code standards and pull request requirements, tips and best practices.
  • Code of Conduct: Behavioral guidelines expected for the project community.

5. API and Documentation

6. Endpoints and Database

  • Endpoint Description: Details of the available API endpoints, including methods, parameters, and usage examples.
  • Database Management: Strategies and practices for efficient management of the database used by the project.

7. Testing

  • Testing Strategies: Approach and methods used to test the software, including unit, integration, and E2E tests.
  • Testing Tools: Description of the testing tools used in the project and how to configure them.

8. CI/CD and Automations

  • CI/CD Pipeline: Explanation of the continuous integration and delivery pipeline, detailing each stage and its function.
  • Automations and Artifact Generation.

9. Configuration Files

10. Best Practices

11. Legal and Licensing

  • Licensing: Information about the rights and restrictions associated with the use of the software.
  • Terms of Use: Information about the terms and conditions for using the software.

12. Projections and Innovations

  • Future Plans: Discussion on functionalities and improvements considered for future versions of the project.
  • Improvement Proposals: Space for the community to suggest and debate improvements and innovations.

13. Attachments and Useful Links

14. Security

  • Security Policy: Details on the supported versions, reporting vulnerabilities, and general security practices.

Clone this wiki locally