Skip to content

Commit

Permalink
Clean up code, add comments, and update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
yang0352 committed Apr 11, 2025
1 parent eabe543 commit d618087
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
## Description

This repository contains source code and supporting files for a serverless application that you can deploy with the SAM CLI.
The application uses a Lambda function to process JSON input data and create a new GitHub repo for **Census EKS CI/CD pipeline**.
The application uses an AWS Lambda function to process JSON input and write it to a cloned repository.
The changes are then committed and pushed to the Census GitHub Enterprise Server, creating a new repository
for the Census EKS CI/CD pipeline.

## Getting Started

Expand All @@ -15,8 +17,8 @@ is required to access the Census GitHub Enterprise Server.
The `PAT` must be securely stored in `AWS Systems Manager Parameter Store`. The parameter name must match the value of the
"SECRET_NAME" constant defined in the `eks_automation/app.py` file.

To access the Census GitHub Enterprise Server, a VPC with private subnets connected to the server must also be attached.
The VPC configuration is set in the `template.yaml` file. Change the `Subnet IDs` and `Security Group IDs` as needed.
To access the Census GitHub Enterprise Server, a VPC with private subnets and a route to the server must be attached.
The VPC configuration is set in the `template.yaml` file. Update the `Subnet IDs` and `Security Group IDs` as needed.

You may also want to adjust other settings (API Usage Plan, tags, etc.) in the `template.yaml` file.

Expand Down Expand Up @@ -83,7 +85,7 @@ You may need to submit a support ticket to request the installation of these too

- Test:

The input `JSON` payload is in the following format:
The `JSON` input payload is in the following format:

```json
{
Expand Down Expand Up @@ -140,7 +142,7 @@ You may need to submit a support ticket to request the installation of these too
'
```

Replace `{API Key}` with the result of the last command and `{API Gateway endpoint URL}` with the value saved from the `sam deploy` command output.
Replace `{API Key}` with the API key we just retrieved, and `{API Gateway endpoint URL}` with the value saved from the `sam deploy` command output.

## Resources

Expand Down
15 changes: 7 additions & 8 deletions eks_automation/app.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
##################################################################
# Script
# @usage python main.py
##################################################################
# from __future__ import print_function
####################################################################################
# This Lambda function takes JSON input, processes it using a Jinja2 template,
# and writes the output to a file in a cloned GitHub repository.
# The changes are then committed and pushed to the Census GitHub Enterprise Server,
# creating a new repository for the Census EKS CI/CD pipeline.
####################################################################################

import os
import stat
import subprocess
import shutil
import logging

# import requests

import json
from jinja2 import Environment, FileSystemLoader

Expand All @@ -36,7 +35,7 @@

# Initialize the logger
logger = logging.getLogger()
logger.setLevel("INFO")
logger.setLevel("INFO") # Set to "ERROR" to reduce logging messages.


# pylint: disable=unused-argument
Expand Down

0 comments on commit d618087

Please sign in to comment.