Skip to content

Commit

Permalink
Merge pull request #709 from WeBankBlockchain/dev
Browse files Browse the repository at this point in the history
v1.5.4 dev=>master
  • Loading branch information
CodingCattwo authored Feb 22, 2022
2 parents 8b68cc3 + 6652fb9 commit 1133ac4
Show file tree
Hide file tree
Showing 55 changed files with 2,275 additions and 1,065 deletions.
69 changes: 63 additions & 6 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ on:

env:
DOCKER_REPOSITORY: webase-front
DOCKER_FISCO_TAG: v2.8.0
DOCKER_FISCO_REPOSITORY: fisco-webase


jobs:
# webase-front
main:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -78,11 +81,65 @@ jobs:

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
# fisco-webase
fisco:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 8
- uses: eskatos/gradle-command-action@v1
with:
arguments: clean build -x test

- name: Get branch name
uses: nelonoel/[email protected]

- name: Fetch tag
run: |
git fetch --tags --force
- name: Get git tag
uses: little-core-labs/[email protected]
id: tag_data
with:
tagRegex: (.*) # Optional. Returns specified group text as tag name. Full tag string is returned if regex is not defined.
tagRegexGroup: 1 # Optional. Default is 1.

# todo get fisco's tag. temporarily use variable of DOCKER_FISCO_TAG
- name: Set docker tag from tag
id: set_docker_tag
run: |
# [[ ${{github.ref}} == */tags/* ]] && DOCKER_TAG="${GIT_TAG_NAME}" || DOCKER_TAG="${BRANCH_NAME}"
# DOCKER_TAG="${{ secrets.DOCKERHUB_ORG }}/${DOCKER_FISCO_REPOSITORY}:${DOCKER_FISCO_TAG}"

echo "New docker tag is ${DOCKER_FISCO_TAG}"
echo "::set-output name=docker_tag::$(echo ${DOCKER_FISCO_TAG})"

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

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

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
push: true
file: ./docker/fisco/Dockerfile
platforms: linux/amd64
tags: ${{ steps.set_docker_tag.outputs.docker_tag }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

# - name: send custom message with args
# uses: appleboy/telegram-action@master
# with:
# to: ${{ secrets.TELEGRAM_TO }}
# token: ${{ secrets.TELEGRAM_TOKEN }}
# args: ${{ steps.set_docker_tag.outputs.docker_tag }} of ${{github.repository }} build success.
14 changes: 14 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
### v1.5.4(2022-02-22)

**Fix**
- 优化合约仓库加载方式,通过`conf/warehouse`目录中的.json文件加载合约模板
- 优化创建随机私钥所调用的JAVASDK的keyFactory问题

**兼容性**
- 支持FISCO-BCOS v2.4.x 及以上版本
- WeBASE-Node-Manager v1.5.0+
- WeBASE-Sign v1.5.0+
- WeBASE-Transaction v1.3.0+

详细了解,请阅读[**技术文档**](https://webasedoc.readthedocs.io/zh_CN/latest/)

### v1.5.3(2021-09-27)

**Add**
Expand Down
37 changes: 37 additions & 0 deletions docker/fisco/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# choose bcos image
ARG BCOS_IMG_VERSION
FROM fiscoorg/fiscobcos:${BCOS_IMG_VERSION:-v2.8.0}
LABEL maintainer [email protected]

# bcos config files
WORKDIR /bcos
# WeBASE-Front files
WORKDIR /front

# setup JDK
RUN apt-get update \
&& apt-get -y install openjdk-8-jdk \
&& rm -rf /var/lib/apt/lists/*

ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
ENV CLASSPATH $JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
ENV PATH $JAVA_HOME/bin:$PATH

# COPY start shell of bcos and front
COPY ["docker/fisco/docker-start.sh", "/docker-start.sh"]

# COPY front files
# cache lib layer
# replace start.sh of front(use active profile)
COPY ["dist/*.sh", "/front/"]
COPY ["dist/lib/", "/front/lib/"]
COPY ["dist/conf_template/", "/front/conf/"]
COPY ["dist/static/", "/front/static/"]
COPY ["dist/gradle/", "/front/gradle/"]
COPY ["dist/apps/", "/front/apps/"]

# expose port
EXPOSE 30300 20200 8545 5002

# start
ENTRYPOINT ["bash","/docker-start.sh"]
120 changes: 120 additions & 0 deletions docker/fisco/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#!/usr/bin/env bash

LOG_WARN() {
local content=${1}
echo -e "\033[31m[WARN] ${content}\033[0m"
}

LOG_INFO() {
local content=${1}
echo -e "\033[32m[INFO] ${content}\033[0m"
}

# 命令返回非 0 时,就退出
set -o errexit
# 管道命令中任何一个失败,就退出
set -o pipefail
# 遇到不存在的变量就会报错,并停止执行
set -o nounset
# 在执行每一个命令之前把经过变量展开之后的命令打印出来,调试时很有用
#set -o xtrace

# 退出时,执行的命令,做一些收尾工作
trap 'echo -e "Aborted, error $? in command: $BASH_COMMAND"; trap ERR; exit 1' ERR

# Set magic variables for current file & dir
# 脚本所在的目录
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# 脚本的全路径,包含脚本文件名
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
# 脚本的名称,不包含扩展名
__base="$(basename ${__file} .sh)"
# 脚本所在的目录的父目录,一般脚本都会在父项目中的子目录,
# 比如: bin, script 等,需要根据场景修改
__root="$(cd "$(dirname "${__dir}")" && pwd)"/../ # <-- change this as it depends on your app
__root=$(realpath -s "${__root}")


########################### properties config ##########################
image_organization=fiscoorg
image_name="fisco-webase"
docker_push="no"
latest_tag=latest
new_tag=
# 父镜像 FISCO-BCOS 的版本(默认版本)
bcos_image_tag="v2.8.0"

########################### parse param ##########################
__cmd="$(basename $0)"
# 解析参数
# usage help doc.
usage() {
cat << USAGE >&2
Usage:
${__cmd} [-h] [-t new_tag] [-p] [-i fiscoorg]
-t New tag for image, required. ex: fisco is v2.8.0, then tag is v2.8.0
-c BCOS docker image tag, default v2.8.0, equal to fiscoorg/fiscobcos:v2.8.0.
-p Push image to docker hub, default no.
-i Default organization, default fiscoorg.
-h Show help info.
USAGE
exit 1
}
while getopts t:i:c:ph OPT;do
case $OPT in
t)
new_tag=$OPTARG
;;
c)
bcos_image_tag=${OPTARG}
;;
p)
docker_push=yes
;;
i)
image_organization=${OPTARG}
;;
h)
usage
exit 3
;;
\?)
usage
exit 4
;;
esac
done


# 必须设置新镜像的版本
if [[ "${new_tag}"x == "x" ]] ; then
LOG_WARN "Need a new_tag for new docker image!! "
usage
exit 1
fi

########################### build docker image ##########################
image_repository="${image_organization}/${image_name}"

## compile project
cd "${__root}" && chmod +x ./gradlew && ./gradlew clean build -x test

## docker build in project root
# cd "${__root}"/dist

docker build -f "${__root}"/docker/fisco/Dockerfile --build-arg BCOS_IMG_VERSION="${bcos_image_tag}" -t ${image_repository}:${new_tag} .
docker tag "${image_repository}:${new_tag}" "${image_repository}:${latest_tag}"


########################### push docker image ##########################
if [[ "${docker_push}"x == "yesx" ]] ; then
docker push "${image_repository}:${new_tag}"
docker push "${image_repository}:${latest_tag}"
fi







13 changes: 13 additions & 0 deletions docker/fisco/docker-start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

# start bcos
cd /data && /usr/local/bin/fisco-bcos -c /data/config.ini >>nohup.out &

# start front
cp -r /data/sdk/* /front/conf/
cd /front && bash start.sh

# keep container running
tail -f /docker-start.sh


2 changes: 1 addition & 1 deletion release_note.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.5.3
v1.5.4

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ public static String constructorEncodedByContractNameAndVersion(String contractN
/**
* encode constructor function
*/
@Deprecated
private static String constructorEncoded(String contractName,
ContractAbiUtil.VersionEvent versionEvent, List<Object> params) throws FrontException {
// Constructor encoded
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public BaseResponse getFolderItemListByStoreId(@PathVariable("storeId") Integer
@GetMapping(value = "/getContractItemByFolderId/{folderId}")
public BaseResponse getContractItemByFolderId(@PathVariable("folderId") Integer folderId) {
log.info("getContractItemByFolderId start. storeId:{}", folderId);
List<ContractItem> contractItemList = contractStoreService.getFolderItemListByFolderId(folderId.longValue());
List<ContractItem> contractItemList = contractStoreService.getContractItemListByFolderId(folderId.longValue());
BaseResponse response = new BaseResponse(ConstantCode.RET_SUCCEED);
response.setData(contractItemList);
return response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public List<ContractFolderItem> getFolderItemListByStoreId(Long storeId) {
/**
*
*/
public List<ContractItem> getFolderItemListByFolderId(Long folderId) {
public List<ContractItem> getContractItemListByFolderId(Long folderId) {
List<ContractItem> contractItemList = contractItemRepository.findByContractFolderId(folderId);
return contractItemList;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.springframework.stereotype.Component;

@Component
public class ContractStroeStartupRunner implements CommandLineRunner {
public class ContractStoreStartupRunner implements CommandLineRunner {

@Autowired
PresetDataService presetDataService;
Expand Down
Loading

0 comments on commit 1133ac4

Please sign in to comment.