Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #23 from ThalesGroup/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
luborpetr authored May 12, 2022
2 parents d385cf4 + c85fc8e commit a35dd33
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 24 deletions.
70 changes: 57 additions & 13 deletions .github/workflows/sanity_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ env:
CHAOS_ENGINE_REPO: "chaos-engine"
CHAOS_ENGINE_IMAGE_NAME: "chaos-engine"

REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
version:
runs-on: [ubuntu-latest]
Expand Down Expand Up @@ -98,31 +101,72 @@ jobs:
name: documentation
path: "documentation"

docker_build:
runs-on: [ubuntu-latest]
# docker_build:
# runs-on: [ubuntu-latest]
# needs: version
# steps:
# - uses: actions/checkout@v1
# - name: Download Variables
# uses: actions/download-artifact@v1
# with:
# name: variables
# - name: Extract Version
# run: mv variables/version version
# - name: Initialize version variable
# run: echo "VERSION=$(cat version)" >> $GITHUB_ENV
# - name: Build and push to registry
# uses: elgohr/Publish-Docker-Github-Action@master
# with:
# name: ${{ env.ORGANIZATION }}/${{ env.CHAOS_ENGINE_REPO }}/${{ env.CHAOS_ENGINE_IMAGE_NAME }}
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# tags: ${{ env.VERSION }}
# registry: docker.pkg.github.com

build-and-push-image:
runs-on: ubuntu-latest
needs: version
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v1
- name: Checkout repository
uses: actions/checkout@v3

- name: Download Variables
uses: actions/download-artifact@v1
with:
name: variables
- name: Extract Version
run: mv variables/version version
- name: Initialize version variable
run: echo "::set-env name=VERSION::$(cat version)"
- name: Build and push to registry
uses: elgohr/Publish-Docker-Github-Action@master
run: echo "VERSION=$(cat version)" >> $GITHUB_ENV

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
name: ${{ env.ORGANIZATION }}/${{ env.CHAOS_ENGINE_REPO }}/${{ env.CHAOS_ENGINE_IMAGE_NAME }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: ${{ env.VERSION }}
registry: docker.pkg.github.com
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

zap_scan:
runs-on: [ubuntu-latest]
needs: docker_build
needs: build-and-push-image
steps:
- uses: actions/checkout@v1
- name: Download Variables
Expand All @@ -132,7 +176,7 @@ jobs:
- name: Extract Version
run: mv variables/version version
- name: Initialize version variable
run: echo "::set-env name=VERSION::$(cat version)"
run: echo "VERSION=$(cat version)" >> $GITHUB_ENV
- name: Docker login
run: docker login $DOCKER_REPOSITORY -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Pull Chaos Engine Docker image
Expand Down
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM python:3-alpine AS build-docs
WORKDIR /mkdocs
COPY ci/docs/mkdocs_requirements.txt requirements.txt
RUN pip install -r requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
COPY docs/ docs/
RUN mkdocs build --config-file docs/mkdocs.yml --site-dir help/

Expand All @@ -10,8 +10,8 @@ WORKDIR /chaosengine
COPY pom.xml ./
COPY chaosengine-launcher/pom.xml ./chaosengine-launcher/
COPY chaosengine-test-utilities ./chaosengine-test-utilities/
RUN mvn -B -f ./chaosengine-test-utilities/pom.xml dependency:go-offline -Dsilent install
RUN mvn -B -f ./chaosengine-launcher/pom.xml dependency:go-offline -Dsilent install
RUN mvn -B -f ./chaosengine-test-utilities/pom.xml dependency:go-offline -Dsilent install \
&& mvn -B -f ./chaosengine-launcher/pom.xml dependency:go-offline -Dsilent install
COPY chaosengine-core/pom.xml ./chaosengine-core/
COPY chaosengine-schedule ./chaosengine-schedule/
COPY chaosengine-notifications ./chaosengine-notifications/
Expand All @@ -23,11 +23,11 @@ COPY chaosengine-core/src/ ./chaosengine-core/src/
COPY --from=build-docs /mkdocs/docs/help ./chaosengine-launcher/src/main/resources/static/help/

ARG BUILD_VERSION
RUN bash -c 'if [[ "${BUILD_VERSION}" =~ ^v?[0-9]+(\.[0-9]+)+ ]] ; then mvn -B versions:set -DnewVersion=${BUILD_VERSION} -DprocessAllModules ; fi'
RUN bash -c 'if [[ "${BUILD_VERSION}" =~ ^v?[0-9]+(\.[0-9]+)+ ]] ; then mvn -B versions:set -DnewVersion=${BUILD_VERSION} -DprocessAllModules ; fi' \
&& mvn -B install && rm -rf chaosengine-test*

RUN mvn -B install && rm -rf chaosengine-test*
FROM openjdk:11.0.15-jre-slim AS develop

FROM openjdk:11.0.12-jre-slim AS develop
EXPOSE 8080
WORKDIR /chaosengine
COPY --from=build-env /chaosengine/*/target/*.jar /chaosengine/*/*/target/*.jar ./lib/
Expand Down
6 changes: 3 additions & 3 deletions ci/docs/mkdocs_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
mkdocs==1.0.4
mkdocs-material==4.4.0
pymdown-extensions==6.0
mkdocs==1.3.0
mkdocs-material==4.6.3
pymdown-extensions==9.4
4 changes: 2 additions & 2 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ extra:
link: 'https://github.com/gemalto/chaos-engine/issues'

copyright: |
&copy; 2018 - <!-- year --> Thales Group<br />
<!-- version -->
&copy; 2018 - 2022 Thales Group<br />
Local Build

0 comments on commit a35dd33

Please sign in to comment.