Files
user-management/.forgejo/workflows/publish-docker.yaml
T
hurui200320 bed3de76dd
Unit test coverage / gradle-test (pull_request) Successful in 7m21s
Unit test coverage / gradle-test (push) Successful in 7m26s
CI for publishing docker image / build-and-publish (push) Successful in 7m2s
Implement query user endpoint for RabbitMQ (#35)
This PR implemented ticket clevermicro/user-management#34 for the user-service-v1 endpoint, along with all the infrastructures required to support the endpoints.

The changes are:
+ switch build tool to gradle for easier access to the private artifacts of clevermicro (although later Brian change the artifacts to public)
+ set up clevermicro amqp client
+ switched to official keycloak admin client instead of implementing it with webflux
+ implement the message formats for the RPC protocol, for now they are exclusive to auth-service, but in the future we will reuse (might with some changes) them for all RPC calls inside clevermicro (need a server lib for handling the message parsing and convertion)
+ implement the user query endpoint
+ implement unit test so the overall coverage is above 85%
+ fixed all issues found during the testing phase with shared env

Currently the latest docker image has been deployed to the shared env, see https://docs.cleverthis.com/en/architecture/microservices/shared-env#multi-user-support

Reviewed-on: #35
2025-07-31 12:56:14 +08:00

91 lines
3.0 KiB
YAML

name: "CI for publishing docker image"
on:
push:
branches:
- "**" # build on all branches since the tag is decided by branch name
workflow_dispatch:
# allow manual trigger
env:
REGISTRY_URL: "git.cleverthis.com"
DEBIAN_FRONTEND: noninteractive
TZ: UTC
DOCKER_HOST: "tcp://docker:2375"
DOCKER_TLS_VERIFY: ""
jobs:
build-and-publish:
runs-on: general
services:
docker:
image: docker:dind
cmd:
- "dockerd"
- "-H"
- "tcp://0.0.0.0:2375"
- "--tls=false"
container:
image: ubuntu:24.04
steps:
# need to setup node and git
- run: |
apt-get update
apt-get install -y nodejs git
# check out code
- uses: actions/checkout@v4
# provide slug version of the envs
- name: Slugify ref name
uses: https://github.com/rlespinasse/slugify-value@v1.4.0
with:
key: GITHUB_REF_NAME
prefix: ""
slug-maxlength: 80
# shorten the sha
- name: Shorten SHA
uses: https://github.com/rlespinasse/shortify-git-revision@v1.6.0
with:
name: GITHUB_SHA
short-on-error: true
length: 7
prefix: ""
# install jdk
- uses: https://github.com/actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"
# ensure executable
- run: chmod +x ./gradlew
# run gradle test and build
# disabled since gradle doesn't require maven token anymore
# - run: |
# ./gradlew check
# ./gradlew bootJar
# env:
# MAVEN_TOKEN: ${{ secrets.REGISTRY_PASSWORD }}
# setup docker
- name: set up docker cli
run: |
apt-get install -y ca-certificates curl dnsutils
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install docker-ce-cli docker-buildx-plugin docker-compose-plugin
# Login to register
- uses: https://github.com/docker/login-action@v3
with:
registry: ${{ env.REGISTRY_URL }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
# file: ci.Dockerfile
file: Dockerfile
push: true
tags: |
${{ env.REGISTRY_URL }}/${{ env.GITHUB_REPOSITORY }}:${{ env.GITHUB_REF_NAME_SLUG }}
${{ env.REGISTRY_URL }}/${{ env.GITHUB_REPOSITORY }}:${{ env.GITHUB_SHA_SHORT }}