Skip to content

Proxy Dev: changed the text #1893

Proxy Dev: changed the text

Proxy Dev: changed the text #1893

Workflow file for this run

---
name: Build afterburner and deploy
on:
create:
tags:
- '*'
push:
paths-ignore:
- '.github/**'
branches: [demo]
pull_request:
branches: [demo]
workflow_dispatch:
inputs:
workflow_call:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout afterburner repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set tag name
run: |
VERSION=$(cat ./VERSION)
echo "TAG_NAME=$VERSION" >> $GITHUB_ENV
# if no tag exists, this is expected to fail
- name: Switch to git tag for release
if: contains(env.TAG_NAME, 'SNAPSHOT') != true
run: |
git fetch --all --tags
git checkout tags/$TAG_NAME -b $TAG_NAME-tmp-branch
- name: Set outputs for short git sha
id: vars
run: |
sha_short=$(git rev-parse --short HEAD)
echo "sha_short=$sha_short" >> $GITHUB_ENV
echo "full_version=$TAG_NAME-$sha_short" >> $GITHUB_ENV
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- name: Build local
working-directory: afterburner-java
run: ../mvnw -Drevision=${{ env.TAG_NAME }} clean install
- name: Create GHA release
uses: ncipollo/release-action@v1
if: contains(env.TAG_NAME, 'SNAPSHOT') != true
with:
artifacts: "afterburner-java/target/afterburner-java-*-exec.jar"
# Build docker image
- name: Create and push docker image
working-directory: afterburner-java
env:
DOCKER_USER: ${{ vars.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: ../mvnw -Drevision=${{ env.TAG_NAME }} -DdockerTargetImageExtension=$sha_short -Pmulti-arch-docker,pyroscope clean package jib:build
## checkout perfana-gitops
- name: Checkout perfana-gitops
uses: actions/checkout@v4
with:
repository: perfana/perfana-gitops
token: ${{ secrets.PAT_GITHUB }}
ref: main
path: perfana-gitops
fetch-depth: 0
- name: Replace image snapshot
working-directory: perfana-gitops
run: |
repository="repository: perfana/afterburner"
tag="tag: $full_version # date: $(date +'%Y-%m-%dT%H:%M:%S')"
echo "$repository"
echo "$tag"
ls -all
sed -i "s|repository: .*|$repository|g" ./apps/acme/demo/optimus-prime-fe/values.yaml
sed -i "s|repository: .*|$repository|g" ./apps/acme/demo/optimus-prime-be/values.yaml
sed -i "s|tag: .*|$tag|g" ./apps/acme/demo/optimus-prime-fe/values.yaml
sed -i "s|tag: .*|$tag|g" ./apps/acme/demo/optimus-prime-be/values.yaml
sed -i "s|repository: .*|$repository|g" ./apps/acme/demo/bumble-bee-fe/values.yaml
sed -i "s|repository: .*|$repository|g" ./apps/acme/demo/bumble-bee-be/values.yaml
sed -i "s|tag: .*|$tag|g" ./apps/acme/demo/bumble-bee-fe/values.yaml
sed -i "s|tag: .*|$tag|g" ./apps/acme/demo/bumble-bee-be/values.yaml
sed -i "s|repository: .*|$repository|g" ./apps/acme/demo/jet-fire-fe/values.yaml
sed -i "s|repository: .*|$repository|g" ./apps/acme/demo/jet-fire-be/values.yaml
sed -i "s|tag: .*|$tag|g" ./apps/acme/demo/jet-fire-fe/values.yaml
sed -i "s|tag: .*|$tag|g" ./apps/acme/demo/jet-fire-be/values.yaml
sed -i "s|repository: .*|$repository|g" ./apps/acme/demo/star-scream-fe/values.yaml
sed -i "s|repository: .*|$repository|g" ./apps/acme/demo/star-scream-be/values.yaml
sed -i "s|tag: .*|$tag|g" ./apps/acme/demo/star-scream-fe/values.yaml
sed -i "s|tag: .*|$tag|g" ./apps/acme/demo/star-scream-be/values.yaml
sed -i "s|repository: .*|$repository|g" ./apps/perfana/test/optimus-prime-fe/values.yaml
sed -i "s|repository: .*|$repository|g" ./apps/perfana/test/optimus-prime-be/values.yaml
sed -i "s|tag: .*|$tag|g" ./apps/perfana/test/optimus-prime-fe/values.yaml
sed -i "s|tag: .*|$tag|g" ./apps/perfana/test/optimus-prime-be/values.yaml
sed -i "s|repository: .*|$repository|g" ./apps/perfana/test/star-scream-fe/values.yaml
sed -i "s|repository: .*|$repository|g" ./apps/perfana/test/star-scream-be/values.yaml
sed -i "s|tag: .*|$tag|g" ./apps/perfana/test/star-scream-fe/values.yaml
sed -i "s|tag: .*|$tag|g" ./apps/perfana/test/star-scream-be/values.yaml
- name: Commit files
run: |
cd perfana-gitops
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action Afterburner"
git commit -m "Bumped afterburner Afterburner images to $full_version in demo and test environment" -a
git push