Skip to content

Commit 6a37b5a

Browse files
authored
Merge pull request #17 from CourseOrchestra/docker
Docker
2 parents db2d05a + f2eeb20 commit 6a37b5a

File tree

13 files changed

+210
-35
lines changed

13 files changed

+210
-35
lines changed

.github/workflows/_discussions.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
All workflows that will be called before pr should be called from ci-pr.yml.
3+
All workflows that will be called after pushing to main should be called from ci-push.yml.
4+
5+
Tests, linters and other quality assurance for module should run inside of workflow named "quality-assurance.yml".
6+
Building and deploying artifact logic for module should run inside of workflow named "deploy.yml".
7+
8+
For version validation you should specify version obtaining logic in .vuh file.

.github/workflows/ci-pr.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: ci
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
7+
jobs:
8+
9+
validate-version:
10+
name: Validate version
11+
uses: ./.github/workflows/validate-current-version.yml
12+
with:
13+
VUH_VERSION: 'v2.9.2'
14+
15+
quality-assurance-api:
16+
name: Quality assurance
17+
uses: ./.github/workflows/quality-assurance.yml
18+
needs: validate-version

.github/workflows/ci-push.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
jobs:
8+
9+
deploy:
10+
name: Deploy mellophone2
11+
uses: ./.github/workflows/deploy.yml
12+
with:
13+
VUH_VERSION: 'v2.9.2'
14+
secrets:
15+
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
16+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
17+
18+
release-notes-generation:
19+
name: Release generation
20+
uses: ./.github/workflows/release-notes-generation.yml
21+
with:
22+
VUH_VERSION: 'v2.9.2'
23+
CHANGELOG_GENERATOR_VERSION: 'v1.0.2'
24+
needs: [deploy]
Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,58 @@
11
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
33

4-
name: ci-mellophone2-prod
4+
name: Deploy mellophone2
55

6-
# Triggers the workflow on push or pull request events but only for the master branch
76
on:
8-
push:
9-
branches: [ main ]
7+
workflow_call:
8+
inputs:
9+
VUH_VERSION: { required: true, type: string }
10+
secrets:
11+
DOCKER_USERNAME:
12+
required: true
13+
DOCKER_PASSWORD:
14+
required: true
1015

11-
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1216
jobs:
13-
# This workflow contains a single job called "build"
1417
build:
15-
18+
name: Deploy mellophone2
1619
runs-on: ubuntu-latest
17-
20+
environment: deployenv
1821
steps:
1922
- name: Checkout
20-
uses: actions/checkout@v2
23+
uses: actions/checkout@v4
24+
- name: Download vuh
25+
run: |
26+
curl https://raw.githubusercontent.com/Greewil/version-update-helper/${{ inputs.VUH_VERSION }}/vuh.sh -O -J -L
27+
chmod +x vuh.sh
28+
- name: Get release version
29+
id: artifact_version
30+
run: |
31+
cur_version=$(./vuh.sh lv -q)
32+
echo "release version: $cur_version"
33+
echo "VERSION=$cur_version" >> "$GITHUB_OUTPUT"
2134
- name: Set up JDK 17 enviroment on ubuntu-latest...
2235
uses: actions/setup-java@v2
2336
with:
2437
java-version: '17'
2538
distribution: 'temurin'
2639
cache: maven
40+
2741
- name: Build mellophone2 with maven
2842
run: mvn clean package
29-
- name: Extract pom project version
30-
run: echo ::set-output name=version::$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
31-
id: projectversiongroup
3243
- uses: papeloto/action-zip@v1
3344
with:
3445
files:
35-
target/mellophone2-${{ steps.projectversiongroup.outputs.version }}.jar
46+
target/mellophone2-${{ steps.artifact_version.outputs.VERSION }}.jar
3647
target/classes/application.yml
3748
target/classes/config/config.xml
38-
dest: ./artifact_for_ftp/mellophone2-${{ steps.projectversiongroup.outputs.version }}.zip
49+
dest: ./artifact_for_ftp/mellophone2-${{ steps.artifact_version.outputs.VERSION }}.zip
3950
- name: Archive production artifacts
4051
uses: actions/upload-artifact@v4
4152
with:
42-
name: mellophone2-${{ steps.projectversiongroup.outputs.version }}
43-
path: ./artifact_for_ftp/mellophone2-${{ steps.projectversiongroup.outputs.version }}.zip
53+
name: mellophone2-${{ steps.artifact_version.outputs.VERSION }}
54+
path: ./artifact_for_ftp/mellophone2-${{ steps.artifact_version.outputs.VERSION }}.zip
55+
4456
- name: 📂 Upload artifact to ftp
4557
uses: SamKirkland/[email protected]
4658
with:
@@ -49,19 +61,21 @@ jobs:
4961
password: ${{ secrets.FTP_CURS_PWD }}
5062
server-dir: development/curs-mellophone2/
5163
local-dir: ./artifact_for_ftp/
52-
- name: Build docker image
53-
run: |
54-
docker build -t curs/mellophone2 .
55-
- name: Log in to Docker Hub
64+
65+
- name: Login to container registry (to Docker Hub)
5666
if: success() && github.ref == 'refs/heads/main'
57-
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
67+
uses: docker/login-action@v3
5868
with:
5969
username: ${{ secrets.DOCKER_USERNAME }}
6070
password: ${{ secrets.DOCKER_PASSWORD }}
61-
- name: Push
71+
- name: Build and push
6272
if: success() && github.ref == 'refs/heads/main'
63-
run: |
64-
docker push curs/mellophone2:latest
73+
uses: docker/build-push-action@v6
74+
with:
75+
push: true
76+
tags: curs/mellophone2:latest , curs/mellophone2:${{ steps.artifact_version.outputs.VERSION }}
77+
context: .
78+
6579
- name: Build documentation
6680
run: |
6781
./_builddoc.sh
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
11
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
33

4-
name: ci-mellophone2-pr
4+
name: Quality Assurance API
55

66
on:
7-
pull_request:
8-
branches: [ main ]
7+
workflow_call:
98

109
jobs:
1110
build:
12-
11+
name: Quality Assurance API
1312
runs-on: ubuntu-latest
1413

1514
steps:
1615
- name: Checkout
17-
uses: actions/checkout@v2
16+
uses: actions/checkout@v4
17+
1818
- name: Set up JDK 17 enviroment on ubuntu-latest...
1919
uses: actions/setup-java@v2
2020
with:
2121
java-version: '17'
2222
distribution: 'temurin'
2323
cache: maven
24-
- name: Build mellophone2 with maven
24+
25+
- name: Build mellophone2 with maven and run tests
2526
run: mvn clean test
27+
2628
- name: Build documentation
2729
run: |
2830
./_builddoc.sh
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Release generation
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
VUH_VERSION: { required: true, type: string }
7+
CHANGELOG_GENERATOR_VERSION: { required: true, type: string }
8+
9+
jobs:
10+
11+
generate_release_from_new_commits:
12+
runs-on: ubuntu-latest
13+
steps:
14+
15+
- name: Git clone this repo
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: download vuh
21+
run: |
22+
curl https://raw.githubusercontent.com/Greewil/version-update-helper/${{ inputs.VUH_VERSION }}/vuh.sh -O -J -L
23+
chmod +x vuh.sh
24+
25+
- name: download release notes generator
26+
run: |
27+
curl https://raw.githubusercontent.com/Greewil/release-notes-generator/${{ inputs.CHANGELOG_GENERATOR_VERSION }}/gen_release_notes.sh -O -J -L
28+
chmod +x gen_release_notes.sh
29+
30+
- name: get release tag_name
31+
id: release_tag
32+
run: |
33+
cur_version=$(./vuh.sh lv -q)
34+
[ "$cur_version" != '' ] || exit 1
35+
echo "release version: $cur_version"
36+
echo "RELEASE_TAG=$cur_version" >> "$GITHUB_OUTPUT"
37+
38+
- name: generate release notes
39+
id: changelog
40+
run: |
41+
./gen_release_notes.sh -i .. -lt -f changelog.md
42+
[ -f "changelog.md" ] && CHANGELOG=$(cat changelog.md) || CHANGELOG=''
43+
echo "$CHANGELOG"
44+
echo 'FINAL_CHANGELOG<<EOF' >> $GITHUB_OUTPUT
45+
echo "$CHANGELOG" >> $GITHUB_OUTPUT
46+
echo 'EOF' >> $GITHUB_OUTPUT
47+
48+
[ -f 'changelog.md' ] && echo "IS_EMPTY=false" >> "$GITHUB_OUTPUT"
49+
[ -f 'changelog.md' ] || echo "IS_EMPTY=true" >> "$GITHUB_OUTPUT"
50+
51+
- name: Create Release
52+
uses: actions/create-release@v1
53+
if: ${{ steps.changelog.outputs.IS_EMPTY == 'false' }}
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
with:
57+
tag_name: "${{ steps.release_tag.outputs.RELEASE_TAG }}"
58+
release_name: "${{ steps.release_tag.outputs.RELEASE_TAG }}"
59+
body: ${{ steps.changelog.outputs.FINAL_CHANGELOG }}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Check new version is greater than main version
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
VUH_VERSION: { required: true, type: string }
7+
8+
jobs:
9+
10+
validate-version:
11+
name: Check new version is greater than main version
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Download vuh
20+
run: |
21+
curl https://raw.githubusercontent.com/Greewil/version-update-helper/${{ inputs.VUH_VERSION }}/vuh.sh -O -J -L
22+
chmod +x vuh.sh
23+
24+
- name: Compare versions
25+
run: |
26+
./vuh.sh sv -q && [ "$(./vuh.sh lv -q)" = "$(./vuh.sh sv -q)" ] || exit 1

.vuh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# This is version update helper config.
2+
# It contains specific to current project variables. With use of this file vuh understands how to extract project's
3+
# version and where project's version variable is located. Vuh can't work with any project without this file!
4+
# If .vuh file located in comparing branch is different from local .vuh file vuh will by default take
5+
# configuration files from handling branches (f.e. local .vuh to work with local version and origin/main:.vuh
6+
# to work with origin/main's version). If your project dont have .vuh file in project's root folder vuh will advice
7+
# you to configure that project.
8+
#
9+
# (Version update helper's page: https://github.com/Greewil/version-update-helper)
10+
11+
# This configuration file is based on project-config-templates/xml-versions-template.
12+
13+
MAIN_BRANCH_NAME='main'
14+
VERSION_FILE='pom.xml'
15+
TEXT_BEFORE_VERSION_CODE='<version>'
16+
TEXT_AFTER_VERSION_CODE='<\/version>'

README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ You may check mellophone is running by issuing the following http request:
1919

2020
[source]
2121
----
22-
http://localhost:8082/mellophone/login?sesid=123&login=login&pwd=pwd
22+
http://localhost:8082/mellophone/login?sesid=123&login=user222&pwd=pwd222
2323
----
2424

2525
If credentials are correct you will get 200 response, otherwise you will get 403 error.

doc/pages/general.adoc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,7 @@
3535
** сервлеты, обслуживающие прямые запросы с серверов веб-приложений;
3636
** один сервлет, обслуживающий запросы от клиентских браузеров, поступающих в виде запросов на отображение фрейма или картинки на странице веб-приложения.
3737
* Протокол, по которому любое веб-приложение может взаимодействовать с сервером аутентификации для обеспечения общей аутентификации.
38-
##
38+
##
39+
40+
Для использования метода /authentication.gif mellophone потребует наличия ssl сертификата для https соединнеия.
41+
Для этого можно будет либо настроить соединение на внешнем веб сервере (через который запросы проходят на mellophone), либо настроить сам mellophone (настройки tomcat для spring boot в application.yml), чтобы он использовал серитификат.

0 commit comments

Comments
 (0)