Skip to content

Commit

Permalink
chore: unite repos (internal, external)
Browse files Browse the repository at this point in the history
- make from/to images configurable
- add GitHub actions
- fix Renovate config
  • Loading branch information
derkoe committed May 31, 2021
1 parent 28fe8fd commit 56f24f6
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 3 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/build-test-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build, Test and Deploy

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:

build-test-and-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: 11
distribution: adopt
- name: Docker Login
uses: Azure/docker-login@v1
with:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build application
run: mvn -B package jib:dockerBuild -Dimage=porscheinformatik/angular-spring-heroes
- name: Build acceptance tests
run: docker build -t heroes-acceptence-tests heroes-acceptence-tests
- name: Run app for tests
run: |
docker run --name ash -d --rm -p 8080:8080 porscheinformatik/angular-spring-heroes
sleep 30
docker run -i --rm --link ash heroes-acceptence-tests --config baseUrl=http://ash:8080
- name: Push image to Docker Hub
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: docker push porscheinformatik/angular-spring-heroes
- name: Push image to ghcr.io
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: |
echo ${{ secrets.GHCR_PASSWORD }} | docker login ghcr.io -u ${{ secrets.GHCR_USERNAME }} --password-stdin
docker tag porscheinformatik/angular-spring-heroes ghcr.io/porscheinformatik/angular-spring-heroes
docker push ghcr.io/porscheinformatik/angular-spring-heroes
54 changes: 54 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: "CodeQL"

on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: '41 21 * * 6'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language: [ 'java', 'javascript' ]

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ build:
variables:
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"
script:
- mvn $MAVEN_CLI_OPTS package jib:build -Djib.container.creationTime=`git show -s --format=%cI $CI_COMMIT_SHA` -DimageTag=$CI_COMMIT_REF_SLUG
- 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
only:
- merge_requests
- master
Expand Down
2 changes: 1 addition & 1 deletion heroes-webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<artifactId>jib-maven-plugin</artifactId>
<configuration>
<from>
<image>docker.porscheinformatik.com/eenv/openjdk:11-jre</image>
<image>${fromImage}</image>
</from>
<to>
<image>docker.porscheinformatik.com/koc/angular-spring-heroes:${imageTag}</image>
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<jib.skip>true</jib.skip>
<frontend-maven-plugin.version>1.12.0</frontend-maven-plugin.version>
<typescript-generator.version>2.31.861</typescript-generator.version>
<fromImage>gcr.io/distroless/java:11</fromImage>
<imageTag>latest</imageTag>
</properties>

Expand Down
2 changes: 1 addition & 1 deletion renovate.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["local>eenv/renovate/renovate-config", "group:allNonMajor"],
"extends": ["github>porscheinformatik/renovate-config", "group:allNonMajor"],
"packageRules": [
{
"matchPackageNames": ["rxjs"],
Expand Down

0 comments on commit 56f24f6

Please sign in to comment.