Skip to content

Commit

Permalink
[CLEANUP] - Adding common Actions Pentaho related things.
Browse files Browse the repository at this point in the history
  • Loading branch information
cardosov committed Jul 4, 2023
1 parent 5c8f690 commit 40c5403
Show file tree
Hide file tree
Showing 5 changed files with 223 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/bootstrap-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM docker.repo.orl.eng.hitachivantara.com/jenkins-build/maven/open-jdk/11

ARG VERSION_MERGER=1.0.8
ARG ARTIFACTORY_URL=https://repo.orl.eng.hitachivantara.com/artifactory/pnt-mvn

RUN curl -L -o version-merger.jar ${ARTIFACTORY_URL}/pentaho/version-merger/${VERSION_MERGER}/version-merger-${VERSION_MERGER}.jar

RUN curl -fL https://install-cli.jfrog.io | sh

RUN curl -L -o jq-linux64 https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 && \
mv jq-linux64 /usr/local/bin/jq && \
chmod +x /usr/local/bin/jq
45 changes: 45 additions & 0 deletions .github/workflows/bootstrap-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build and Push Container Image

on:
push:
paths: [ .github/bootstrap-image/** ]
env:
ARTIFACTORY: cicd-oci-release-orl.repo.orl.eng.hitachivantara.com
IMAGE: ${{ github.repository_owner }}/${{ github.event.repository.name }}
jobs:

bootstrap-image:
name: CI Image build and push [${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ github.ref_name }}]
runs-on: [ self-hosted, Linux, k8s ]
steps:

# sets the image name and tag to something like: <owner>/<repo>:<current_date_as_YYYYYMMDD>.<build-number>
- name: Update image tag
run: |
IMAGE_TAG=$(date +'%Y%m%d').${{ github.run_number }}
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV
echo "IMAGE=${{ env.IMAGE }}:$IMAGE_TAG" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v3

- name: Build
id: build-image
run: docker build -t "${{ env.ARTIFACTORY }}/${{ env.IMAGE }}" -f .github/bootstrap-image/Dockerfile .

- name: Push to Artifactory
id: push-to-artifactory
run: |
echo "${{ secrets.ARTIFACTORY_API_KEY }}" | docker login "${{ env.ARTIFACTORY }}" --username "${{ secrets.ARTIFACTORY_USER }}" --password-stdin
docker push "${{ env.ARTIFACTORY }}/${{ env.IMAGE }}"
- name: Summary
run: |
echo "Image built:"\ >> $GITHUB_STEP_SUMMARY
echo "<pre>" >> $GITHUB_STEP_SUMMARY
docker images >> $GITHUB_STEP_SUMMARY
echo "</pre>"\ >> $GITHUB_STEP_SUMMARY
echo "Image pushed: '${{ env.ARTIFACTORY }}/${{ env.IMAGE }}'" >> $GITHUB_STEP_SUMMARY
- uses: rickstaa/action-create-tag@v1
with:
tag: "build-image-${{ env.IMAGE_TAG }}"
message: "${{ env.ARTIFACTORY }}/${{ env.IMAGE }}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.idea
22 changes: 22 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "Common Pentaho Maven Settings file"
description: "Common Pentaho Maven Settings file"

outputs:
settings-file-path:
description: "Maven settings file path"
value: ${{ steps.settings-file.outputs.path }}

runs:
using: "composite"
steps:

- name: Checkout code
uses: actions/checkout@v3

- name: Return settings.xml
id: settings-file
shell: sh
run: |
file_path="$GITHUB_ACTION_PATH/settings.xml"
echo "path=${file_path}" >> $GITHUB_OUTPUT
143 changes: 143 additions & 0 deletions settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

<mirrors>
<mirror>
<id>pentaho.resolve.repo</id>
<url>${env.RESOLVE_REPO_MIRROR}</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>

<servers>
<server>
<id>pentaho.resolve.repo</id>
<username>${env.NEXUS_DEPLOY_USER}</username>
<password>${env.NEXUS_DEPLOY_PASSWORD}</password>
</server>
<server>
<id>pentaho.public.release.repo</id>
<username>${env.NEXUS_DEPLOY_USER}</username>
<password>${env.NEXUS_DEPLOY_PASSWORD}</password>
</server>
<server>
<id>pentaho.public.snapshot.repo</id>
<username>${env.NEXUS_DEPLOY_USER}</username>
<password>${env.NEXUS_DEPLOY_PASSWORD}</password>
</server>
<server>
<id>pentaho.private.release.repo</id>
<username>${env.NEXUS_DEPLOY_USER}</username>
<password>${env.NEXUS_DEPLOY_PASSWORD}</password>
</server>
<server>
<id>pentaho.private.snapshot.repo</id>
<username>${env.NEXUS_DEPLOY_USER}</username>
<password>${env.NEXUS_DEPLOY_PASSWORD}</password>
</server>
<server>
<id>nexus.pentaho.org:8001</id>
<username>${env.NEXUS_DEPLOY_USER}</username>
<password>${env.NEXUS_DEPLOY_PASSWORD}</password>
</server>
<server>
<id>nexus.pentaho.org:8002</id>
<username>${env.NEXUS_DEPLOY_USER}</username>
<password>${env.NEXUS_DEPLOY_PASSWORD}</password>
</server>
<server>
<id>nexus3.pentaho.com:8001</id>
<username>${env.NEXUS_DEPLOY_USER}</username>
<password>${env.NEXUS_DEPLOY_PASSWORD}</password>
</server>
<server>
<id>nexus3.pentaho.com:8002</id>
<username>${env.NEXUS_DEPLOY_USER}</username>
<password>${env.NEXUS_DEPLOY_PASSWORD}</password>
</server>
<server>
<id>pnt-docker.repo.orl.eng.hitachivantara.com</id>
<username>${env.NEXUS_DEPLOY_USER}</username>
<password>${env.NEXUS_DEPLOY_PASSWORD}</password>
</server>
<server>
<id>pntprv-docker-dev-orl.repo.orl.eng.hitachivantara.com</id>
<username>${env.NEXUS_DEPLOY_USER}</username>
<password>${env.NEXUS_DEPLOY_PASSWORD}</password>
</server>
<server>
<id>pntprv-docker-release-orl.repo.orl.eng.hitachivantara.com</id>
<username>${env.NEXUS_DEPLOY_USER}</username>
<password>${env.NEXUS_DEPLOY_PASSWORD}</password>
</server>
<server>
<id>pntpub-docker-dev-orl.repo.orl.eng.hitachivantara.com</id>
<username>${env.NEXUS_DEPLOY_USER}</username>
<password>${env.NEXUS_DEPLOY_PASSWORD}</password>
</server>
<server>
<id>pntpub-docker-release-orl.repo.orl.eng.hitachivantara.com</id>
<username>${env.NEXUS_DEPLOY_USER}</username>
<password>${env.NEXUS_DEPLOY_PASSWORD}</password>
</server>
</servers>

<profiles>
<profile>
<id>pentaho</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<!-- Artifact repositories -->
<pentaho.public.release.repo>${env.PUBLIC_RELEASE_REPO_URL}</pentaho.public.release.repo>
<pentaho.public.snapshot.repo>${env.PUBLIC_SNAPSHOT_REPO_URL}</pentaho.public.snapshot.repo>
<pentaho.private.release.repo>${env.PRIVATE_RELEASE_REPO_URL}</pentaho.private.release.repo>
<pentaho.private.snapshot.repo>${env.PRIVATE_SNAPSHOT_REPO_URL}</pentaho.private.snapshot.repo>

<pentaho.docker.pull.host>${env.DOCKER_PULL_HOST}</pentaho.docker.pull.host>
<pentaho.docker.public.push.host>${env.DOCKER_PUBLIC_PUSH_HOST}</pentaho.docker.public.push.host>
<pentaho.docker.private.push.host>${env.DOCKER_PRIVATE_PUSH_HOST}</pentaho.docker.private.push.host>

<!-- hide test output clutter -->
<maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>

<!-- let the build become unstable with failed tests instead of failing -->
<maven.test.failure.ignore>true</maven.test.failure.ignore>
</properties>
<repositories>
<repository>
<id>pentaho-public</id>
<name>pentaho-public</name>
<url>${env.RESOLVE_REPO_MIRROR}</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>pentaho-public</id>
<name>pentaho-public</name>
<url>${env.RESOLVE_REPO_MIRROR}</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>

0 comments on commit 40c5403

Please sign in to comment.