Microservice application for listing all non-forked GitHub repositories details for provided username through exposed API GET endpoint "/user/{username}/repositories". Built with Spring Boot (v3.2.0), Java (v21) and Spock framework (v2.3).
You can simply run the app as a service by invoking command:
java -jar target/TuiCodeChallenge-0.0.1-SNAPSHOT.jar
If you have Docker installed you can build the image & run the container by invoking following commands:
docker build -t com.example/tuicodechallenge .
docker run -p8080:8080 com.example/tuicodechallenge
Deployment using AWS CLI:
aws cloudformation create-stack --stack-name tui-example-ecs-stack --template-body file://aws/samTemplate.yaml --capabilities CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND
Deployment on Jenkins - please use following Jenkinsfile
Swagger/OpenAPI 3.0 specification can be found here. Few examples of curl requests & responses:
curl http://localhost:8080/user/radeklesniewski/repositories -H "Accept: application/json"
< HTTP/1.1 200
[{"repositoryName":"DoodleGenerator","ownerLogin":"radeklesniewski","
branchList":[{"branchName":"master","lastCommitSha":"92626a4b79811ffd062924217f517ae261476199"}]},{"repositoryName":"
Neuron","ownerLogin":"radeklesniewski","
branchList":[{"branchName":"master","lastCommitSha":"efbc0b82c5a2c5c592ec0d96b16de5c07631a9a1"},{"branchName":"test","lastCommitSha":"efbc0b82c5a2c5c592ec0d96b16de5c07631a9a1"}]},{"
repositoryName":"ScatterSearchForTSP","ownerLogin":"radeklesniewski","
branchList":[{"branchName":"master","lastCommitSha":"1f4dd5d9c11365f87faf7c6b03b4ccfd5686e690"}]}]
curl http://localhost:8080/user/radeklesniewski/repositories -H "Accept: application/xml"
< HTTP/1.1 406
{"message":"No acceptable representation","status":406}
curl http://localhost:8080/user/nonExistingUser/repositories -H "Accept: application/json"
< HTTP/1.1 404
{"message":"Provided username could not be found.","status":404}
-
As an api consumer, given username and header “Accept: application/json”, I would like to list all his github repositories, which are not forks. Information, which I require in the response, is:
a. Repository Name
b. Owner Login
c. For each branch it’s name and last commit sha
-
As an api consumer, given not existing github user, I would like to receive 404 responses in such a format: {“status”: ${responseCode}, “message”: ${whyHasItHappened} }
-
As an api consumer, given header “Accept: application/xml”, I would like to receive 406 responses in such a format: {“status”: ${responseCode}, “message”: ${whyHasItHappened} }
Notes
- Please full-fill the given acceptance criteria, delivering us your best code compliant with industry standards.
- Please use https://developer.github.com/v3 as a backing API
- Please write your api spec in swagger yaml file
- Application should have a proper README.md file
- Please use any reactive framework of your choice (Java or NodeJs preferably)
- Proper unit and integration test cases
Extended challenge
It is not mandatory to do the below deployment setup that is part of the extended challenge but if provided it will be added points to the assessment and will also confirm your devops working knowledge. Deployment setup:
- Prepare Dockerfile so that app can be run in a container
- Prepare CloudFormation scripts so that the containerized app will be run as a Fargate service (or directly in ECS you choose)
- Prepare CloudFormation scripts, that will create API Gateway and expose the app thru it
- Prepare Jenkins pipeline, that will build the app and deploy it to AWS using scripts from steps above (use free tier AWS account)