Deployment 0.0.1 #25

Merged
Maece97 merged 34 commits from dev into main 2021-10-17 13:49:10 +00:00
3 changed files with 163 additions and 136 deletions
Showing only changes of commit 4a85548a9e - Show all commits

View File

@ -4,75 +4,94 @@
name: Build and Deploy name: Build and Deploy
on: on:
push: push:
branches: branches:
- main - main
workflow_dispatch: workflow_dispatch:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: read contents: read
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Set up JDK 11 - name: Set up JDK 11
uses: actions/setup-java@v2 uses: actions/setup-java@v2
with: with:
java-version: "11" java-version: "11"
distribution: "adopt" distribution: "adopt"
- run: mkdir ./target - run: mkdir ./target
- name: Build with Maven - name: Cache Maven packages
run: mvn -f tapas-tasks/pom.xml --batch-mode --update-snapshots verify uses: actions/cache@v1
- run: cp ./tapas-tasks/target/tapas-tasks-0.0.1-SNAPSHOT.jar ./target with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build with Maven - name: Build with Maven
run: mvn -f app/pom.xml --batch-mode --update-snapshots verify run: mvn -f assignment/pom.xml --batch-mode --update-snapshots verify
- run: cp ./app/target/app-0.1.0.jar ./target - run: cp ./assignment/target/assignment-0.0.1-SNAPSHOT.jar ./target
- run: cp ./.deployment/docker-compose.yml ./target - name: Build with Maven
- name: Archive artifacts run: mvn -f executor-pool/pom.xml --batch-mode --update-snapshots verify
uses: actions/upload-artifact@v1 - run: cp ./executor-pool/target/executor-pool-0.0.1.jar ./target
with:
name: app
path: ./target/
deploy: - name: Build with Maven
runs-on: ubuntu-latest run: mvn -f executor1/pom.xml --batch-mode --update-snapshots verify
needs: [build] - run: cp ./executor1/target/executor1-0.0.1.jar ./target
steps:
- name: Download app artifacts
uses: actions/download-artifact@v1
with:
name: app
- name: Copy host via scp
uses: appleboy/scp-action@master
env:
HOST: ${{ secrets.SSH_HOST }}
USERNAME: ${{ secrets.SSH_USER }}
PORT: 22
KEY: ${{ secrets.SSH_PRIVATE_KEY }}
with:
source: "app/*"
target: "/home/${{ secrets.SSH_USER }}/"
strip_components: 1
rm: false
overwrite: true
- name: Executing remote command - name: Build with Maven
uses: appleboy/ssh-action@master run: mvn -f executor2/pom.xml --batch-mode --update-snapshots verify
with: - run: cp ./executor2/target/executor2-0.0.1.jar ./target
host: ${{ secrets.SSH_HOST }}
USERNAME: ${{ secrets.SSH_USER }} - name: Build with Maven
PORT: 22 run: mvn -f tapas-tasks/pom.xml --batch-mode --update-snapshots verify
KEY: ${{ secrets.SSH_PRIVATE_KEY }} - run: cp ./tapas-tasks/target/tapas-tasks-0.0.1.jar ./target
script: |
cd /home/${{ secrets.SSH_USER }}/ - run: cp ./.deployment/docker-compose.yml ./target
touch acme.json - name: Archive artifacts
sudo chmod 0600 acme.json uses: actions/upload-artifact@v1
sudo echo "PUB_IP=$(wget -qO- http://ipecho.net/plain | xargs echo)" | sed -e 's/\./-/g' > .env with:
sudo docker-compose up -d name: app
path: ./target/
deploy:
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Download app artifacts
uses: actions/download-artifact@v1
with:
name: app
- name: Copy host via scp
uses: appleboy/scp-action@master
env:
HOST: ${{ secrets.SSH_HOST }}
USERNAME: ${{ secrets.SSH_USER }}
PORT: 22
KEY: ${{ secrets.SSH_PRIVATE_KEY }}
with:
source: "app/*"
target: "/home/${{ secrets.SSH_USER }}/"
strip_components: 1
rm: false
overwrite: true
- name: Executing remote command
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
USERNAME: ${{ secrets.SSH_USER }}
PORT: 22
KEY: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd /home/${{ secrets.SSH_USER }}/
touch acme.json
sudo chmod 0600 acme.json
sudo echo "PUB_IP=$(wget -qO- http://ipecho.net/plain | xargs echo)" | sed -e 's/\./-/g' > .env
sudo docker-compose up -d

View File

@ -1,41 +1,45 @@
name: CI Executor 1 name: CI Executor 1
on: on:
push: push:
branches: [main, dev] branches: [main, dev]
paths: paths:
- "executor1/**" - "executor-base/**"
pull_request: - "executor1/**"
branches: [main, dev] pull_request:
paths: branches: [main, dev]
- "executor1/**" paths:
- "executor-base/**"
- "executor1/**"
workflow_dispatch: workflow_dispatch:
jobs: jobs:
build: build:
name: Build name: Build
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Set up JDK 11 - name: Set up JDK 11
uses: actions/setup-java@v1 uses: actions/setup-java@v1
with: with:
java-version: 11 java-version: 11
- name: Cache SonarCloud packages - name: Cache SonarCloud packages
uses: actions/cache@v1 uses: actions/cache@v1
with: with:
path: ~/.sonar/cache path: ~/.sonar/cache
key: ${{ runner.os }}-sonar key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages - name: Cache Maven packages
uses: actions/cache@v1 uses: actions/cache@v1
with: with:
path: ~/.m2 path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2 restore-keys: ${{ runner.os }}-m2
- name: Build and analyze - name: Build executorBase
env: run: mvn -f executor-base/pom.xml -B verify
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Build and analyze
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} env:
run: mvn -f executor1/pom.xml -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=scs-asse-fs21-group1_tapas-executor1 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -f executor1/pom.xml -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=scs-asse-fs21-group1_tapas-executor1

View File

@ -1,41 +1,45 @@
name: CI Executor 2 name: CI Executor 2
on: on:
push: push:
branches: [main, dev] branches: [main, dev]
paths: paths:
- "executor2/**" - "executor-base/**"
pull_request: - "executor2/**"
branches: [main, dev] pull_request:
paths: branches: [main, dev]
- "executor2/**" paths:
- "executor-base/**"
- "executor2/**"
workflow_dispatch: workflow_dispatch:
jobs: jobs:
build: build:
name: Build name: Build
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Set up JDK 11 - name: Set up JDK 11
uses: actions/setup-java@v1 uses: actions/setup-java@v1
with: with:
java-version: 11 java-version: 11
- name: Cache SonarCloud packages - name: Cache SonarCloud packages
uses: actions/cache@v1 uses: actions/cache@v1
with: with:
path: ~/.sonar/cache path: ~/.sonar/cache
key: ${{ runner.os }}-sonar key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages - name: Cache Maven packages
uses: actions/cache@v1 uses: actions/cache@v1
with: with:
path: ~/.m2 path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2 restore-keys: ${{ runner.os }}-m2
- name: Build and analyze - name: Build executorBase
env: run: mvn -f executor-base/pom.xml -B verify
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Build and analyze
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} env:
run: mvn -f executor2/pom.xml -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=scs-asse-fs21-group1_tapas-executor2 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -f executor2/pom.xml -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=scs-asse-fs21-group1_tapas-executor2