Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Main and Pr build workflows #160

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Main Build

on:
push:
branches: [main]

env:
IMAGE_TAG: latest
REGISTRY: ghcr.io
NAMESPACE: galasa-dev

jobs:
build-simplatform:
name: Building Simple Platform
jaydee029 marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'semeru'
cache: maven

- name: Print Githash
run: |
echo $GITHUB_SHA > ./simplatform.githash

- name: Building galasa-simplatform-application using maven
run: |
mvn -f galasa-simplatform-application/pom.xml deploy \
-Dgalasa.source.repo=https://development.galasa.dev/gh/maven-repo/obr \
-Dgalasa.central.repo=https://repo.maven.apache.org/maven2/ \
-Dgalasa.release.repo=file:${{ github.workspace }}/repo \
--batch-mode --errors --fail-at-end \
--settings ${{github.workspace}}/settings.xml

- name: Building galasa-simbank-tests using maven
run: |
mvn -f galasa-simbank-tests/pom.xml deploy \
-Dgalasa.source.repo=https://development.galasa.dev/gh/maven-repo/obr \
-Dgalasa.central.repo=https://repo.maven.apache.org/maven2/ \
-Dgalasa.release.repo=file:${{ github.workspace }}/repo \
--batch-mode --errors --fail-at-end \
--settings ${{github.workspace}}/settings.xml

- name: Login to Github Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata for Simplatform image
jaydee029 marked this conversation as resolved.
Show resolved Hide resolved
id: metadata-simplatform
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/simplatform-artefacts
jaydee029 marked this conversation as resolved.
Show resolved Hide resolved

- name: Build Simplatform image for development Maven registry
id: build-simplatform
uses: docker/build-push-action@v5
with:
context: .
file: dockerfiles/dockerfile.simplatform
push: true
tags: ${{ steps.metadata-simplatform.outputs.tags }}
labels: ${{ steps.metadata-simplatform.outputs.labels }}
build-args: |
baseVersion=${{env.IMAGE_TAG}}
jaydee029 marked this conversation as resolved.
Show resolved Hide resolved
dockerRepository=harbor.galasa.dev
jaydee029 marked this conversation as resolved.
Show resolved Hide resolved
branch=main

- name: Extract metadata for Simplatform image
jaydee029 marked this conversation as resolved.
Show resolved Hide resolved
id: metadata-simplatform-jar
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/simplatform-jar-artefacts
jaydee029 marked this conversation as resolved.
Show resolved Hide resolved

- name: Build Simplatform image for development Maven registry
jaydee029 marked this conversation as resolved.
Show resolved Hide resolved
id: build-simplatform-jar
uses: docker/build-push-action@v5
with:
context: .
file: dockerfiles/dockerfile.simplatform-amd64
push: true
tags: ${{ steps.metadata-simplatform-jar.outputs.tags }}
labels: ${{ steps.metadata-simplatform-jar.outputs.labels }}

- name: Recycle application in ArgoCD
env:
ARGOCD_AUTH_TOKEN: ${{ secrets.ARGOCD_TOKEN }}
run: |
docker run --env ARGOCD_AUTH_TOKEN=${{ env.ARGOCD_AUTH_TOKEN }} --rm -v ${{ github.workspace }}:/var/workspace ghcr.io/galasa-dev/argocdcli:main app actions run gh-maven-repos restart --kind Deployment --resource-name simplatform-gh --server argocd.galasa.dev
jaydee029 marked this conversation as resolved.
Show resolved Hide resolved

# Wait for the application to show as healthy in ArgoCD
- name: Wait for app health in ArgoCD
env:
ARGOCD_AUTH_TOKEN: ${{ secrets.ARGOCD_TOKEN }}
run: |
docker run --env ARGOCD_AUTH_TOKEN=${{ env.ARGOCD_AUTH_TOKEN }} --rm -v ${{ github.workspace }}:/var/workspace ghcr.io/galasa-dev/argocdcli:main app wait gh-maven-repos --resource apps:Deployment:simplatform-gh --health --server argocd.galasa.dev
jaydee029 marked this conversation as resolved.
Show resolved Hide resolved

59 changes: 59 additions & 0 deletions .github/workflows/pr-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: PR Build

on:
pull_request:
branches: [main]

env:
IMAGE_TAG: latest

jobs:
build-simplatform:
name: Building Simple Platform
jaydee029 marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'semeru'
cache: maven

- name: Print Githash
run: |
echo $GITHUB_SHA > ./simplatform.githash

- name: Building galasa-simplatform-application using maven
run: |
mvn -f galasa-simplatform-application/pom.xml deploy -Dgpg.skip=true \
-Dgalasa.source.repo=https://development.galasa.dev/gh/maven-repo/obr \
-Dgalasa.central.repo=https://repo.maven.apache.org/maven2/ \
-Dgalasa.release.repo=file:${{ github.workspace }}/repo \
--batch-mode --errors --fail-at-end \
--settings ${{github.workspace}}/settings.xml

- name: Building galasa-simbank-tests using maven
run: |
mvn -f galasa-simbank-tests/pom.xml deploy -Dgpg.skip=true \
-Dgalasa.source.repo=https://development.galasa.dev/gh/maven-repo/obr \
-Dgalasa.central.repo=https://repo.maven.apache.org/maven2/ \
-Dgalasa.release.repo=file:${{ github.workspace }}/repo \
--batch-mode --errors --fail-at-end \
--settings ${{github.workspace}}/settings.xml

- name: Build Simplatform image for testing
uses: docker/build-push-action@v5
with:
context: .
file: dockerfiles/dockerfile.simplatform
load: true
tags: simplatform:test
jaydee029 marked this conversation as resolved.
Show resolved Hide resolved
build-args: |
baseVersion=${{env.IMAGE_TAG}}
jaydee029 marked this conversation as resolved.
Show resolved Hide resolved
dockerRepository=harbor.galasa.dev
jaydee029 marked this conversation as resolved.
Show resolved Hide resolved
branch=main

11 changes: 11 additions & 0 deletions dockerfiles/dockerfile.simplatform
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ARG baseVersion
ARG dockerRepository
FROM ${dockerRepository}/galasadev/galasa-base:${baseVersion}
jaydee029 marked this conversation as resolved.
Show resolved Hide resolved

ARG branch

RUN sed -i "s/--branchname--/${branch}/" /usr/local/apache2/conf/httpd.conf
RUN sed -i 's/--repositoryname--/simplatform/' /usr/local/apache2/conf/httpd.conf

COPY repo/ /usr/local/apache2/htdocs/
COPY simplatform.githash /usr/local/apache2/htdocs/simplatform.githash
20 changes: 20 additions & 0 deletions dockerfiles/dockerfile.simplatform-amd64
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM harbor.galasa.dev/docker_proxy_cache/library/openjdk:11-jdk

RUN mkdir /galasa

RUN useradd -u 1000 -d /galasa galasa && \
chown -R galasa:galasa /galasa

WORKDIR /galasa

USER galasa

COPY galasa-simplatform-application/galasa-simplatform-3270/target/galasa-simplatform-0.24.0.jar /galasa/simplatform.jar

VOLUME /galasa/.galasa
VOLUME /galasa/load

EXPOSE 2080/tcp
EXPOSE 2023/tcp
EXPOSE 2027/tcp
EXPOSE 2040/tcp