Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmoonl1ght94 committed Oct 7, 2024
1 parent 0ce620c commit 7343574
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 169 deletions.
52 changes: 16 additions & 36 deletions .github/workflows/branch-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: "Infra: Feature Testing: Init env"

on:
workflow_dispatch:

pull_request:
types: ['labeled']

Expand All @@ -19,61 +18,42 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
token: ${{ github.token }}

- name: get branch name
id: extract_branch
run: |
tag='pr${{ github.event.pull_request.number }}'
echo "tag=${tag}" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'zulu'
cache: 'maven'
- name: Build

- name: Build Maven Project
id: build
run: |
./mvnw -B -ntp versions:set -DnewVersion=$GITHUB_SHA
./mvnw -B -V -ntp clean package -Pprod -DskipTests
export VERSION=$(./mvnw -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Configure AWS credentials for Kafka-UI account
uses: aws-actions/configure-aws-credentials@v4
- name: Build and Push Docker Image
uses: ./.github/workflows/build-docker
with:
tag: ${{ steps.extract_branch.outputs.tag }}
version: ${{ steps.build.outputs.version }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build and push
id: docker_build_and_push
uses: docker/build-push-action@v5
with:
builder: ${{ steps.buildx.outputs.name }}
context: api
push: true
tags: 297478128798.dkr.ecr.eu-central-1.amazonaws.com/kafka-ui:${{ steps.extract_branch.outputs.tag }}
build-args: |
JAR_FILE=api-${{ steps.build.outputs.version }}.jar
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
repository: 297478128798.dkr.ecr.eu-central-1.amazonaws.com/kafka-ui
build-context: api

outputs:
tag: ${{ steps.extract_branch.outputs.tag }}

make-branch-env:
needs: build
runs-on: ubuntu-latest
Expand All @@ -89,7 +69,7 @@ jobs:
git config --global user.email "[email protected]"
git config --global user.name "infra-tech"
git add ../kafka-ui-from-branch/
git commit -m "added env:${{ needs.build.outputs.deploy }}" && git push || true
git commit -m "added env:${{ needs.build.outputs.tag }}" && git push || true
- name: update status check for private deployment
if: ${{ github.event.label.name == 'status/feature_testing' }}
Expand All @@ -98,7 +78,7 @@ jobs:
authToken: ${{secrets.GITHUB_TOKEN}}
context: "Click Details button to open custom deployment page"
state: "success"
sha: ${{ github.event.pull_request.head.sha || github.sha }}
sha: ${{ github.event.pull_request.head.sha || github.sha }}
target_url: "http://${{ needs.build.outputs.tag }}.internal.ui.kafbat.dev"

- name: update status check for public deployment
Expand All @@ -108,5 +88,5 @@ jobs:
authToken: ${{secrets.GITHUB_TOKEN}}
context: "Click Details button to open custom deployment page"
state: "success"
sha: ${{ github.event.pull_request.head.sha || github.sha }}
sha: ${{ github.event.pull_request.head.sha || github.sha }}
target_url: "http://${{ needs.build.outputs.tag }}.internal.ui.kafbat.dev"
46 changes: 17 additions & 29 deletions .github/workflows/cve_checks.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: "Infra: CVE checks"

on:
workflow_dispatch:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 8 15 * *'

permissions:
Expand All @@ -17,49 +17,37 @@ jobs:
with:
token: ${{ github.token }}

- name: get branch name
id: extract_branch
run: |
tag='build-${{ github.sha }}'
echo "tag=${tag}" >> $GITHUB_OUTPUT
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'zulu'
cache: 'maven'

- name: Build project
- name: Build Maven Project
id: build
run: |
./mvnw -B -ntp versions:set -DnewVersion=$GITHUB_SHA
./mvnw -B -V -ntp clean package -DskipTests
export VERSION=$(./mvnw -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build docker image
uses: docker/build-push-action@v5
- name: Build Docker Image (no push)
uses: ./.github/workflows/build-docker
with:
builder: ${{ steps.buildx.outputs.name }}
context: api
platforms: linux/amd64
push: false
load: true
tags: |
ghcr.io/kafbat/kafka-ui:${{ steps.build.outputs.version }}
build-args: |
JAR_FILE=api-${{ steps.build.outputs.version }}.jar
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
tag: ${{ steps.extract_branch.outputs.tag }}
version: ${{ steps.build.outputs.version }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
repository: ghcr.io/kafbat/kafka-ui
build-context: api

- name: Run CVE checks
uses: aquasecurity/[email protected]
Expand Down
45 changes: 14 additions & 31 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: "Main: Build & deploy"

on:
workflow_dispatch:

push:
branches: [ "main" ]

Expand Down Expand Up @@ -37,21 +37,16 @@ jobs:
export VERSION=$(./mvnw -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
echo "version=${VERSION}" >> $GITHUB_OUTPUT
# docker images

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Cache Docker layers
uses: actions/cache@v4
- name: Build & Push Docker Image
uses: ./.github/workflows/build-docker
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
tag: ${{ steps.build.outputs.version }}
version: ${{ steps.build.outputs.version }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
repository: ghcr.io/kafbat/kafka-ui
build-context: api

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
Expand All @@ -60,19 +55,7 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build & push docker image
id: docker_build_and_push
uses: docker/build-push-action@v5
with:
builder: ${{ steps.buildx.outputs.name }}
context: api
platforms: linux/amd64,linux/arm64
provenance: false
push: true
tags: |
ghcr.io/kafbat/kafka-ui:${{ steps.build.outputs.version }}
ghcr.io/kafbat/kafka-ui:main
build-args: |
JAR_FILE=api-${{ steps.build.outputs.version }}.jar
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Push additional tag for main branch
run: |
docker tag ghcr.io/kafbat/kafka-ui:${{ steps.build.outputs.version }} ghcr.io/kafbat/kafka-ui:main
docker push ghcr.io/kafbat/kafka-ui:main
53 changes: 12 additions & 41 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: "Infra: Release"

on:
release:
types: [ published ]
Expand All @@ -18,8 +19,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
token: ${{ github.token }}
ref: ${{ github.sha }}

- run: |
git config user.name github-actions
Expand Down Expand Up @@ -52,47 +52,18 @@ jobs:
with:
name: kafbat-ui-${{ steps.build.outputs.version }}
path: api/target/api-${{ steps.build.outputs.version }}.jar
#################
# #
# Docker images #
# #
#################
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
id: docker_build_and_push
uses: docker/build-push-action@v5
# Docker images
- name: Build & Push Docker Image
uses: ./.github/workflows/build-docker
with:
builder: ${{ steps.buildx.outputs.name }}
context: api
platforms: linux/amd64,linux/arm64
provenance: false
push: true
tags: |
ghcr.io/kafbat/kafka-ui:${{ steps.build.outputs.version }}
ghcr.io/kafbat/kafka-ui:latest
build-args: |
JAR_FILE=api-${{ steps.build.outputs.version }}.jar
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
tag: ${{ steps.build.outputs.version }}
version: ${{ steps.build.outputs.version }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
repository: ghcr.io/kafbat/kafka-ui
build-context: api

charts:
runs-on: ubuntu-latest
Expand Down
45 changes: 13 additions & 32 deletions .github/workflows/separate_env_public_create.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: "Infra: Feature Testing Public: Init env"

on:
workflow_dispatch:
inputs:
Expand All @@ -19,59 +20,39 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
token: ${{ github.token }}

- name: get branch name
id: extract_branch
run: |
tag="${{ github.event.inputs.ENV_NAME }}-$(date '+%F-%H-%M-%S')"
echo "tag=${tag}" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'zulu'
cache: 'maven'
- name: Build

- name: Build Maven Project
id: build
run: |
./mvnw -B -ntp versions:set -DnewVersion=$GITHUB_SHA
./mvnw -B -V -ntp clean package -Pprod -DskipTests
export VERSION=$(./mvnw -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Configure AWS credentials for Kafka-UI account
uses: aws-actions/configure-aws-credentials@v4
- name: Build & Push Docker Image
uses: ./.github/workflows/build-docker
with:
tag: ${{ steps.extract_branch.outputs.tag }}
version: ${{ steps.build.outputs.version }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build and push
id: docker_build_and_push
uses: docker/build-push-action@v5
with:
builder: ${{ steps.buildx.outputs.name }}
context: api
push: true
tags: 297478128798.dkr.ecr.eu-central-1.amazonaws.com/kafka-ui:${{ steps.extract_branch.outputs.tag }}
build-args: |
JAR_FILE=api-${{ steps.build.outputs.version }}.jar
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
repository: 297478128798.dkr.ecr.eu-central-1.amazonaws.com/kafka-ui
build-context: api

outputs:
tag: ${{ steps.extract_branch.outputs.tag }}

Expand Down

0 comments on commit 7343574

Please sign in to comment.