Skip to content

Commit a5743a3

Browse files
committed
chore: unite repos (internal, external)
- make from/to images configurable - add GitHub actions - fix Renovate config
1 parent 28fe8fd commit a5743a3

6 files changed

Lines changed: 118 additions & 3 deletions

File tree

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Build, Test and Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
13+
build-test-and-push:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Set up JDK 11
18+
uses: actions/setup-java@v2
19+
with:
20+
java-version: 11
21+
distribution: adopt
22+
- name: Docker Login
23+
uses: Azure/docker-login@v1
24+
with:
25+
username: ${{ secrets.REGISTRY_USERNAME }}
26+
password: ${{ secrets.REGISTRY_PASSWORD }}
27+
- name: Build application
28+
run: mvn -B package jib:dockerBuild
29+
- name: Build acceptance tests
30+
run: docker build -t heroes-acceptence-tests heroes-acceptence-tests
31+
- name: Run app for tests
32+
run: |
33+
docker run --name ash -d --rm -p 8080:8080 porscheinformatik/angular-spring-heroes
34+
sleep 30
35+
docker run -i --rm --link ash heroes-acceptence-tests --config baseUrl=http://ash:8080
36+
- name: Push image to Docker Hub
37+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
38+
run: docker push porscheinformatik/angular-spring-heroes
39+
- name: Push image to ghcr.io
40+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
41+
run: |
42+
echo ${{ secrets.GHCR_PASSWORD }} | docker login ghcr.io -u ${{ secrets.GHCR_USERNAME }} --password-stdin
43+
docker tag porscheinformatik/angular-spring-heroes ghcr.io/porscheinformatik/angular-spring-heroes
44+
docker push ghcr.io/porscheinformatik/angular-spring-heroes
45+
46+
deploy:
47+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
48+
needs: build-test-and-push
49+
runs-on: ubuntu-latest
50+
environment:
51+
name: production
52+
url: https://ash.k8s.derkoe.dev
53+
steps:
54+
- uses: actions/checkout@v2
55+
- uses: Azure/setup-helm@v1
56+
- name: Deploy to Kubernetes
57+
run: |
58+
echo "${{ secrets.KUBECONFIG_BASE64 }}" | base64 --decode > /tmp/kubeconfig
59+
helm ls --kubeconfig /tmp/kubeconfig
60+
helm upgrade --kubeconfig /tmp/kubeconfig --install --atomic --set ingress.enabled=true --set ingress.host=ash.k8s.derkoe.dev --set postgresql.enabled=true --set postgresql.postgresPassword=${{ secrets.POSTGRESQL_PASSWORD }} ash charts/angular-spring-heroes
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
schedule:
11+
- cron: '41 21 * * 6'
12+
13+
jobs:
14+
analyze:
15+
name: Analyze
16+
runs-on: ubuntu-latest
17+
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
language: [ 'java', 'javascript' ]
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v2
26+
27+
# Initializes the CodeQL tools for scanning.
28+
- name: Initialize CodeQL
29+
uses: github/codeql-action/init@v1
30+
with:
31+
languages: ${{ matrix.language }}
32+
# If you wish to specify custom queries, you can do so here or in a config file.
33+
# By default, queries listed here will override any specified in a config file.
34+
# Prefix the list here with "+" to use these queries and those in the config file.
35+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
36+
37+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
38+
# If this step fails, then you should remove it and run the build manually (see below)
39+
- name: Autobuild
40+
uses: github/codeql-action/autobuild@v1
41+
42+
# ℹ️ Command-line programs to run using the OS shell.
43+
# 📚 https://git.io/JvXDl
44+
45+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
46+
# and modify them (or add more) to build your code if your project
47+
# uses a compiled language
48+
49+
#- run: |
50+
# make bootstrap
51+
# make release
52+
53+
- name: Perform CodeQL Analysis
54+
uses: github/codeql-action/analyze@v1

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ build:
1616
variables:
1717
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -Djib.from.auth.username=$DOCKER_REGISTRY_USER -Djib.from.auth.password=$DOCKER_REGISTRY_PASSWORD -Djib.to.auth.username=$DOCKER_REGISTRY_USER -Djib.to.auth.password=$DOCKER_REGISTRY_PASSWORD"
1818
script:
19-
- mvn $MAVEN_CLI_OPTS package jib:build -Djib.container.creationTime=`git show -s --format=%cI $CI_COMMIT_SHA` -DimageTag=$CI_COMMIT_REF_SLUG
19+
- mvn $MAVEN_CLI_OPTS package jib:build -DfromImage=docker.porscheinformatik.com/eenv/openjdk:11-jre -Djib.container.creationTime=`git show -s --format=%cI $CI_COMMIT_SHA` -DimageTag=$CI_COMMIT_REF_SLUG
2020
only:
2121
- merge_requests
2222
- master

heroes-webapp/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
<artifactId>jib-maven-plugin</artifactId>
8181
<configuration>
8282
<from>
83-
<image>docker.porscheinformatik.com/eenv/openjdk:11-jre</image>
83+
<image>${fromImage}</image>
8484
</from>
8585
<to>
8686
<image>docker.porscheinformatik.com/koc/angular-spring-heroes:${imageTag}</image>

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<jib.skip>true</jib.skip>
1818
<frontend-maven-plugin.version>1.12.0</frontend-maven-plugin.version>
1919
<typescript-generator.version>2.31.861</typescript-generator.version>
20+
<fromImage>gcr.io/distroless/java:11</fromImage>
2021
<imageTag>latest</imageTag>
2122
</properties>
2223

renovate.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3-
"extends": ["local>eenv/renovate/renovate-config", "group:allNonMajor"],
3+
"extends": ["github>porscheinformatik/renovate-config", "group:allNonMajor"],
44
"packageRules": [
55
{
66
"matchPackageNames": ["rxjs"],

0 commit comments

Comments
 (0)