diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..669b90c --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,36 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the "master" branch + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 + + # Runs a single command using the runners shell + - name: Run a one-line script + run: echo "hai" + + # Runs a set of commands using the runners shell + - name: Run a multi-line script + run: | + echo Add other actions to build, + echo test, and deploy your project. diff --git a/Jenkinsfile b/Jenkinsfile index 31e3560..1c61ea3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,27 +1,20 @@ pipeline { - agent { label 'java-slave' } - stages { + agent any + stages { stage('Build') { - steps { - sh 'mvn clean package' - } - } + - stage('push to jfrog') { - steps { - rtUpload ( - serverId: 'jfrog', - spec: '''{ - "files": [ - { - "pattern": "target/*.war", - "target": "java_app/" - } - ] - }''', - ) - } - } + agent { + docker { image 'lacosted/mavenjava' } + } + steps { + sh 'mvn --version' + } } + + + + } +} diff --git a/Jenkinsfile_docker_master b/Jenkinsfile_docker_master new file mode 100644 index 0000000..d3d5765 --- /dev/null +++ b/Jenkinsfile_docker_master @@ -0,0 +1,21 @@ +pipeline { + agent none + stages { + stage('Back-end') { + agent { + docker { image 'maven:3-alpine' } + } + steps { + sh 'mvn --version' + } + } + stage('Front-end') { + agent { + docker { image 'node:7-alpine' } + } + steps { + sh 'node --version' + } + } + } +} diff --git a/Jenkinsfile_docker_pipeline b/Jenkinsfile_docker_pipeline index f889874..a8182f8 100644 --- a/Jenkinsfile_docker_pipeline +++ b/Jenkinsfile_docker_pipeline @@ -1,14 +1,17 @@ pipeline { agent { - docker { - image 'maven:3-alpine' - } + label 'docker-slave' } stages { - stage('Build') { + stage('Back-end') { + agent { + docker-slave { image 'maven:3-alpine' } + } steps { - sh 'mvn package' + sh 'mvn --version' } } + } } + diff --git a/Jenkinsfile_dynamic_docker b/Jenkinsfile_dynamic_docker new file mode 100644 index 0000000..429ad64 --- /dev/null +++ b/Jenkinsfile_dynamic_docker @@ -0,0 +1,33 @@ +pipeline { + agent {label 'dynamic_docker'} + stages { + stage('Run Tests') { + + parallel { + stage('UT Test On parallel') { + + steps { + sh 'echo thread 1' + } + post { + always { + sh ' echo post build' + } + } + } + stage('IT Test On parallel') { + + steps { + sh 'echo thread 2' + } + post { + always { + sh 'echo post build' + } + + } + } + } + } + } +} diff --git a/ansible_jenkins_role.yaml b/ansible_jenkins_role.yaml new file mode 100644 index 0000000..e683db1 --- /dev/null +++ b/ansible_jenkins_role.yaml @@ -0,0 +1,4 @@ +- hosts: all + become: yes + roles: + - darkwizard242.jenkinslts diff --git a/ansile-apache2-handlers b/ansile-apache2-handlers new file mode 100644 index 0000000..2bdcfed --- /dev/null +++ b/ansile-apache2-handlers @@ -0,0 +1,24 @@ +- hosts: webserver + become: yes + tasks: + - name: install apache2 + apt: name=apache2 update_cache=yes state=latest + + - name: enabled mod_rewrite + apache2_module: name=rewrite state=present + notify: + - restart apache2 + + - name: apache2 listen on port 8081 + lineinfile: dest=/etc/apache2/ports.conf regexp="^Listen 80" line="Listen 8081" state=present + notify: + - restart apache2 + + - name: apache2 virtualhost on port 8081 + lineinfile: dest=/etc/apache2/sites-available/000-default.conf regexp="^" line="" state=present + notify: + - restart apache2 + + handlers: + - name: restart apache2 + service: name=apache2 state=restarted diff --git a/f5 b/f5 index e69de29..3fb3e9c 100644 --- a/f5 +++ b/f5 @@ -0,0 +1,5 @@ +sdfdsfsd +dsfsdf +lsdhjfksdhkfs +kjjhj +kjbkj diff --git a/f6 b/f6 index 949f459..601092e 100644 --- a/f6 +++ b/f6 @@ -1 +1,5 @@ khfklsdjhl +jkhgkjgjh +klhjk +ljhjkh +ljkhkj diff --git a/jenkins_userdat_linux b/jenkins_userdat_linux new file mode 100644 index 0000000..5f3e634 --- /dev/null +++ b/jenkins_userdat_linux @@ -0,0 +1,9 @@ +#!/bin/bash +sudo yum update -y +sudo yum install wget +sudo amazon-linux-extras install java-openjdk11 +sudo amazon-linux-extras install epel -y +sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo +sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key +sudo yum install jenkins -y +sudo service jenkins start diff --git a/src/main/java/com/websystique/springmvc/service/UserService.java b/src/main/java/com/websystique/springmvc/service/UserService.java index 4f5e72d..3142ab1 100644 --- a/src/main/java/com/websystique/springmvc/service/UserService.java +++ b/src/main/java/com/websystique/springmvc/service/UserService.java @@ -7,6 +7,8 @@ + + public interface UserService { User findById(long id); diff --git a/user_data_apache2_ubuntu b/user_data_apache2_ubuntu new file mode 100644 index 0000000..741cbb1 --- /dev/null +++ b/user_data_apache2_ubuntu @@ -0,0 +1,4 @@ +#!/bin/bash +apt update -y +apt install apache2 -y +service apache2 start