Skip to content

Commit

Permalink
Merge remote-tracking branch 'entur/main_config'
Browse files Browse the repository at this point in the history
  • Loading branch information
t2gran committed Jan 28, 2025
2 parents eafb919 + 13e3012 commit 313fb35
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 20 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/entur-docker-build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
name: Entur - Build and push Docker
name: "B - Build and push docker"
run-name: "Build and push docker image - ${{inputs.version}}"
on:
repository_dispatch:
types: [trigger-downstream-ci]
workflow_call:
inputs:
version:
description: "The OTP version"
required: false
type: string
jobs:
maven-verify:
runs-on: ubuntu-24.04
Expand All @@ -24,7 +29,9 @@ jobs:
${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
${{ runner.os }}-maven-
${{ runner.os }}-
- name: "Checkout OTP using Git tag - ${{ inputs.version }} "
run: |
git checkout "tags/${{ inputs.version }}"
- name: Run maven build
run: mvn verify -Dps -DskipTests
- uses: actions/[email protected]
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/entur-main-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "0 - OTP Pipline"
on:
schedule:
- cron: '33 0 * * 1-5'
workflow_dispatch:
inputs:
log_level:
description: 'Log level'
required: true
default: 'info'
type: choice
options:
- info
- debug
git_tag:
description: 'Manually set OTP Git tag to promote - run pipline using an existing OTP
release. This is used when building a release on a local developer machine.
Example input: v2.7.0-entur-48'
required: false
default: ''
type: string
jobs:
release-otp:
name: "Build, test, tag & release OTP jar 🛠️"
uses: ./.github/workflows/entur-maven-project-release.yml
with:
git_tag: ${{ inputs.git_tag }}
log_level: ${{ inputs.log_level }}

build-docker-image:
name: "Build and publish docker image 🎁"
uses: ./.github/workflows/entur-maven-project-release.yml
needs: release-otp
with:
version: ${{needs.release-otp.outputs.version}}
52 changes: 36 additions & 16 deletions .github/workflows/entur-maven-project-release.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
name: Entur - Release OTP Maven project
name: "A - Release OTP Maven project"
on:
workflow_dispatch:
inputs:
logLevel:
log_level:
description: 'Log level'
required: true
default: 'info'
type: choice
options:
- info
- debug
schedule:
- cron: '33 0 * * 1-5'
workflow_call:
inputs:
log_level:
type: string
default: 'info'
git_tag:
type: string
outputs:
version:
description: 'The OTP version'
value: ${{ jobs.release.outputs.version }}
ser_ver_id:
description: 'The OTP serialization id'
value: ${{ jobs.release.outputs.ser_ver_id }}
jobs:
release:
runs-on: ubuntu-latest
outputs:
version: ${{steps.set_version.outputs.version}}
ser_ver_id: ${{steps.set_ser_ver_id.outputs.ser_ver_id}}
steps:
- name: Checkout entur/OpenTripPlanner
uses: actions/checkout@v4
Expand All @@ -37,9 +52,10 @@ jobs:
${{ runner.os }}-maven-
${{ runner.os }}-
- name: Release OTP
if: ${{ ! inputs.git_tag }}
env:
CUSTOM_RELEASE_GIT_HUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CUSTOM_RELEASE_LOG_LEVEL: ${{ inputs.logLevel }}
CUSTOM_RELEASE_LOG_LEVEL: ${{ inputs.log_level }}
run: |
echo "Start otp release script"
git config user.name github-actions[bot]
Expand All @@ -51,17 +67,21 @@ jobs:
echo "Run script/custom-release.py otp/dev-2.x"
script/custom-release.py otp/dev-2.x
echo "GHA_DOCKER_PUSH_IMAGE_TAG=`git describe --tags --abbrev=0`" >> $GITHUB_ENV
- name: Trigger downstream CI
- name: Checkout Released OTP Tag
if: ${{ inputs.git_tag }}
run: |
git checkout "tags/${{ inputs.git_tag }}"
- name: Set version (Git repository Tag)
id: set_version
run: |
VERSION_GIT_TAG=$(git describe --exact-match HEAD)
echo "Set 'version=${VERSION_GIT_TAG}'"
echo "version=${VERSION_GIT_TAG}" >> $GITHUB_OUTPUT
- name: Set serialization version ID
id: set_ser_ver_id
run: |
repo_owner="entur"
repo_name="OpenTripPlanner"
event_type="trigger-downstream-ci"
service="otp"
echo "Triggering downstream CI for $service with version $GHA_DOCKER_PUSH_IMAGE_TAG"
curl -X POST \
-H "Authorization: token ${{ secrets.GITFLOW_PAT }}" \
-H "Accept: application/vnd.github.everest-preview+json" \
-H "Content-Type: application/json" https://api.github.com/repos/$repo_owner/$repo_name/dispatches \
-d "{\"event_type\": \"$event_type\", \"client_payload\": {\"service\": \"$service\", \"version\": \"$GHA_DOCKER_PUSH_IMAGE_TAG\", \"unit\": false, \"integration\": true}}"
SER_VER_ID=$(mvn help:evaluate -Dexpression=otp.serialization.version.id -q -DforceStdout)
echo "Set ser_ver_id=${SER_VER_ID}"
echo "ser_ver_id=${SER_VER_ID}" >> $GITHUB_OUTPUT

0 comments on commit 313fb35

Please sign in to comment.