From 114d3b2181f8c1feb092ec0cde2599a47a4daf8a Mon Sep 17 00:00:00 2001 From: Pedro Paulo Bazzo Date: Tue, 2 Mar 2021 05:05:15 -0300 Subject: [PATCH 1/4] new lambda --- .../compile/default-compile/createdFiles.lst | 0 .../compile/default-compile/inputFiles.lst | 4 ++++ 2 files changed, 4 insertions(+) create mode 100644 helloworldjava/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst create mode 100644 helloworldjava/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst diff --git a/helloworldjava/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/helloworldjava/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..e69de29 diff --git a/helloworldjava/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/helloworldjava/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..9bca14a --- /dev/null +++ b/helloworldjava/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,4 @@ +/home/pedropbazzo/Documentos/AWS/aws-lambda-terraform-java-play/helloworldjava/src/main/java/uk/co/danielbryant/exp/helloworld/view/Response.java +/home/pedropbazzo/Documentos/AWS/aws-lambda-terraform-java-play/helloworldjava/src/main/java/uk/co/danielbryant/exp/helloworld/HelloLambdaHandler.java +/home/pedropbazzo/Documentos/AWS/aws-lambda-terraform-java-play/helloworldjava/src/main/java/uk/co/danielbryant/exp/helloworld/service/HelloService.java +/home/pedropbazzo/Documentos/AWS/aws-lambda-terraform-java-play/helloworldjava/src/main/java/uk/co/danielbryant/exp/helloworld/view/Request.java From a80f9876b5ab08bc848034a7dd0944d89bfbe58b Mon Sep 17 00:00:00 2001 From: Pedro Paulo Bazzo Date: Tue, 2 Mar 2021 05:07:07 -0300 Subject: [PATCH 2/4] aws.yml --- .github/workflows/aws.yml | 80 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .github/workflows/aws.yml diff --git a/.github/workflows/aws.yml b/.github/workflows/aws.yml new file mode 100644 index 0000000..81a6cd6 --- /dev/null +++ b/.github/workflows/aws.yml @@ -0,0 +1,80 @@ +# This workflow will build and push a new container image to Amazon ECR, +# and then will deploy a new task definition to Amazon ECS, when a release is created +# +# To use this workflow, you will need to complete the following set-up steps: +# +# 1. Create an ECR repository to store your images. +# For example: `aws ecr create-repository --repository-name my-ecr-repo --region us-east-2`. +# Replace the value of `ECR_REPOSITORY` in the workflow below with your repository's name. +# Replace the value of `aws-region` in the workflow below with your repository's region. +# +# 2. Create an ECS task definition, an ECS cluster, and an ECS service. +# For example, follow the Getting Started guide on the ECS console: +# https://us-east-2.console.aws.amazon.com/ecs/home?region=us-east-2#/firstRun +# Replace the values for `service` and `cluster` in the workflow below with your service and cluster names. +# +# 3. Store your ECS task definition as a JSON file in your repository. +# The format should follow the output of `aws ecs register-task-definition --generate-cli-skeleton`. +# Replace the value of `task-definition` in the workflow below with your JSON file's name. +# Replace the value of `container-name` in the workflow below with the name of the container +# in the `containerDefinitions` section of the task definition. +# +# 4. Store an IAM user access key in GitHub Actions secrets named `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`. +# See the documentation for each action used below for the recommended IAM policies for this IAM user, +# and best practices on handling the access key credentials. + +on: + release: + types: [created] + +name: Deploy to Amazon ECS + +jobs: + deploy: + name: Deploy + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-2 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build, tag, and push image to Amazon ECR + id: build-image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: my-ecr-repo + IMAGE_TAG: ${{ github.sha }} + run: | + # Build a docker container and + # push it to ECR so that it can + # be deployed to ECS. + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" + + - name: Fill in the new image ID in the Amazon ECS task definition + id: task-def + uses: aws-actions/amazon-ecs-render-task-definition@v1 + with: + task-definition: task-definition.json + container-name: sample-app + image: ${{ steps.build-image.outputs.image }} + + - name: Deploy Amazon ECS task definition + uses: aws-actions/amazon-ecs-deploy-task-definition@v1 + with: + task-definition: ${{ steps.task-def.outputs.task-definition }} + service: sample-app-service + cluster: default + wait-for-service-stability: true From 550e269870569d19c12b274800dff233a4c857c8 Mon Sep 17 00:00:00 2001 From: Pedro Paulo Bazzo Date: Tue, 2 Mar 2021 05:09:07 -0300 Subject: [PATCH 3/4] Create maven-publish.yml --- .github/workflows/maven-publish.yml | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/maven-publish.yml diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml new file mode 100644 index 0000000..5de62b4 --- /dev/null +++ b/.github/workflows/maven-publish.yml @@ -0,0 +1,30 @@ +# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created +# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path + +name: Maven Package + +on: + release: + types: [created] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + server-id: github # Value of the distributionManagement/repository/id field of the pom.xml + settings-path: ${{ github.workspace }} # location for the settings.xml file + + - name: Build with Maven + run: mvn -B package --file pom.xml + + - name: Publish to GitHub Packages Apache Maven + run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml + env: + GITHUB_TOKEN: ${{ github.token }} From 90c73ab0aceec5be968db1105da8f5942061a733 Mon Sep 17 00:00:00 2001 From: Pedro Paulo Bazzo Date: Tue, 2 Mar 2021 05:10:55 -0300 Subject: [PATCH 4/4] Add .circleci/config.yml --- .circleci/config.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..6f98693 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,13 @@ +# Use the latest 2.1 version of CircleCI pipeline process engine. See: https://circleci.com/docs/2.0/configuration-reference +version: 2.1 +# Use a package of configuration called an orb. +orbs: + # Declare a dependency on the welcome-orb + welcome: circleci/welcome-orb@0.4.1 +# Orchestrate or schedule a set of jobs +workflows: + # Name the workflow "welcome" + welcome: + # Run the welcome/run job in its own container + jobs: + - welcome/run