mirror of
https://github.com/valitydev/holmes.git
synced 2024-11-06 01:45:25 +00:00
TD-292: Add GH Actions CI workflow (#1)
* Switch proto upstreams to valitydev: valitydev/bender-proto@38ce3ff valitydev/binbase-proto@9db92d9 valitydev/cds-proto@ed9f907 valitydev/damsel@d384c12 valitydev/fistful-proto@c45166d valitydev/limiter-proto@8c08550 valitydev/machinegun-proto@af57ba1 valitydev/msgpack-proto@8742c7a * Rewrite Dockerfile * Include protocols as full-fledged git repos * Add GH Actions CI workflow
This commit is contained in:
parent
c819da773c
commit
4cdec0411f
4
.env
Normal file
4
.env
Normal file
@ -0,0 +1,4 @@
|
||||
OTP_VERSION=24.2.0
|
||||
STEP_VERSION=0.19.0
|
||||
THRIFT_VERSION=0.14.2.2
|
||||
WOORL_VERSION=1.6
|
56
.github/workflows/build-image.yaml
vendored
Normal file
56
.github/workflows/build-image.yaml
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
name: Build Docker image
|
||||
on:
|
||||
pull_request:
|
||||
branches: ["**"]
|
||||
push:
|
||||
branches: [master]
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Construct tags / labels for an image
|
||||
id: meta
|
||||
uses: docker/metadata-action@v3
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ github.repository }}
|
||||
tags: type=sha
|
||||
|
||||
# https://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions#setting-an-environment-variable
|
||||
- name: Update environment variables
|
||||
run: grep -v '^#' .env >> $GITHUB_ENV
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
|
||||
- name: Setup Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
push: ${{ github.event_name == 'push' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
platforms: linux/amd64
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
build-args: |
|
||||
OTP_VERSION=${{ env.OTP_VERSION }}
|
||||
STEP_VERSION=${{ env.STEP_VERSION }}
|
||||
THRIFT_VERSION=${{ env.THRIFT_VERSION }}
|
||||
WOORL_VERSION=${{ env.WOORL_VERSION }}
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,2 @@
|
||||
Dockerfile
|
||||
lib/scripts
|
||||
woorlrc
|
||||
|
35
.gitmodules
vendored
35
.gitmodules
vendored
@ -1,31 +1,30 @@
|
||||
[submodule "build_utils"]
|
||||
path = build_utils
|
||||
url = git@github.com:rbkmoney/build_utils.git
|
||||
branch = master
|
||||
[submodule "damsel"]
|
||||
path = damsel
|
||||
url = git@github.com:rbkmoney/damsel.git
|
||||
url = https://github.com/valitydev/damsel.git
|
||||
branch = master
|
||||
[submodule "lib/observer_cli"]
|
||||
path = lib/observer_cli
|
||||
url = https://github.com/keynslug/observer_cli
|
||||
url = https://github.com/zhongwencool/observer_cli
|
||||
branch = master
|
||||
[submodule "mgproto"]
|
||||
path = mgproto
|
||||
url = git@github.com:rbkmoney/machinegun_proto
|
||||
[submodule "cds_proto"]
|
||||
path = cds_proto
|
||||
url = git@github.com:rbkmoney/cds-proto.git
|
||||
[submodule "machinegun-proto"]
|
||||
path = machinegun-proto
|
||||
url = https://github.com/valitydev/machinegun-proto.git
|
||||
[submodule "cds-proto"]
|
||||
path = cds-proto
|
||||
url = https://github.com/valitydev/cds-proto.git
|
||||
branch = master
|
||||
[submodule "bender-proto"]
|
||||
path = bender-proto
|
||||
url = git@github.com:rbkmoney/bender-proto.git
|
||||
[submodule "msgpack-proto"]
|
||||
path = msgpack-proto
|
||||
url = git@github.com:rbkmoney/msgpack-proto.git
|
||||
url = https://github.com/valitydev/bender-proto.git
|
||||
[submodule "binbase-proto"]
|
||||
path = binbase-proto
|
||||
url = git@github.com:rbkmoney/binbase-proto.git
|
||||
url = https://github.com/valitydev/binbase-proto.git
|
||||
[submodule "limiter-proto"]
|
||||
path = limiter-proto
|
||||
url = git@github.com:rbkmoney/limiter-proto.git
|
||||
url = https://github.com/valitydev/limiter-proto.git
|
||||
[submodule "fistful-proto"]
|
||||
path = fistful-proto
|
||||
url = https://github.com/valitydev/fistful-proto.git
|
||||
[submodule "msgpack-proto"]
|
||||
path = msgpack-proto
|
||||
url = https://github.com/valitydev/msgpack-proto.git
|
||||
|
54
Dockerfile
Normal file
54
Dockerfile
Normal file
@ -0,0 +1,54 @@
|
||||
ARG OTP_VERSION
|
||||
|
||||
FROM docker.io/library/erlang:${OTP_VERSION} AS builder
|
||||
|
||||
COPY . /holmes
|
||||
WORKDIR /holmes
|
||||
RUN make
|
||||
RUN ./clone-proto-modules.sh /repos
|
||||
|
||||
FROM docker.io/library/erlang:${OTP_VERSION}
|
||||
|
||||
RUN apt-get --yes update \
|
||||
&& apt-get --yes --no-install-recommends install \
|
||||
curl=7.74.0-1.3+deb11u1 \
|
||||
bind9-dnsutils=1:9.16.27-1~deb11u1 \
|
||||
git=1:2.30.2-1 \
|
||||
iproute2=5.10.0-4 \
|
||||
iputils-ping=3:20210202-1 \
|
||||
iputils-tracepath=3:20210202-1 \
|
||||
less=551-2 \
|
||||
nano=5.4-2 \
|
||||
netcat-openbsd=1.217-3 \
|
||||
jq=1.6-2.1 \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# step-cli
|
||||
ARG STEP_VERSION
|
||||
ARG TARGETARCH
|
||||
RUN wget -nv -O step-cli.deb "https://dl.step.sm/gh-release/cli/docs-cli-install/v${STEP_VERSION}/step-cli_${STEP_VERSION}_${TARGETARCH}.deb" \
|
||||
&& dpkg -i step-cli.deb \
|
||||
&& rm -vf step-cli.deb
|
||||
|
||||
# thrift
|
||||
ARG THRIFT_VERSION
|
||||
ARG TARGETARCH
|
||||
RUN wget -nv -O- "https://github.com/valitydev/thrift/releases/download/${THRIFT_VERSION}/thrift-${THRIFT_VERSION}-linux-${TARGETARCH}.tar.gz" \
|
||||
| tar -xvz -C /usr/local/bin/
|
||||
|
||||
# woorl
|
||||
ARG WOORL_VERSION
|
||||
RUN wget -nv -O- "https://github.com/valitydev/woorl/releases/download/${WOORL_VERSION}/woorl-${WOORL_VERSION}.tar.gz" \
|
||||
| tar -xvz -C /usr/local/bin/ \
|
||||
&& ln -sf woorl /usr/local/bin/woorl-json
|
||||
|
||||
COPY ./scripts /opt/holmes/scripts
|
||||
COPY --from=builder /repos /opt/holmes/
|
||||
COPY --from=builder /holmes/lib/scripts /opt/holmes/scripts
|
||||
COPY woorlrc.sample /opt/holmes/
|
||||
|
||||
WORKDIR /opt/holmes
|
||||
ENV CHARSET=UTF-8
|
||||
ENV LANG=C.UTF-8
|
||||
CMD ["/usr/local/bin/epmd"]
|
@ -1,41 +0,0 @@
|
||||
#!/bin/bash
|
||||
cat <<EOF
|
||||
FROM $BASE_IMAGE
|
||||
MAINTAINER Igor Savchuk <i.savchuk@rbkmoney.com>
|
||||
ENV THRIFT_PORT=8022 \
|
||||
CDS=cds \
|
||||
SHUMWAY=shumway \
|
||||
HELLGATE=hellgate \
|
||||
MACHINEGUN=machinegun \
|
||||
PROXY_TINKOFF=proxy-tinkoff \
|
||||
PROXY_VTB=proxy-vtb \
|
||||
PROXY_AGENT=proxy-agent \
|
||||
PROXY_MOCKETBANK=proxy-mocketbank \
|
||||
PROXY_MOCKET_INSPECTOR=proxy-inspector \
|
||||
PROXY_PIMP=pimp
|
||||
COPY ./damsel/proto /opt/holmes/damsel/proto
|
||||
COPY ./cds_proto/proto /opt/holmes/cds_proto/proto
|
||||
COPY ./binbase-proto/proto /opt/holmes/binbase-proto/proto
|
||||
COPY ./limiter-proto/proto /opt/holmes/limiter-proto/proto
|
||||
COPY ./scripts /opt/holmes/scripts
|
||||
COPY ./lib/scripts /opt/holmes/scripts
|
||||
CMD epmd
|
||||
# A bit of magic below to get a proper branch name
|
||||
# even when the HEAD is detached (Hey Jenkins!
|
||||
# BRANCH_NAME is available in Jenkins env).
|
||||
LABEL com.rbkmoney.$SERVICE_NAME.parent=$BASE_IMAGE_NAME \
|
||||
com.rbkmoney.$SERVICE_NAME.parent_tag=$BASE_IMAGE_TAG \
|
||||
com.rbkmoney.$SERVICE_NAME.build_img=build \
|
||||
com.rbkmoney.$SERVICE_NAME.build_img_tag=$BUILD_IMAGE_TAG \
|
||||
com.rbkmoney.$SERVICE_NAME.commit_id=$(git rev-parse HEAD) \
|
||||
com.rbkmoney.$SERVICE_NAME.commit_number=$(git rev-list --count HEAD) \
|
||||
com.rbkmoney.$SERVICE_NAME.branch=$( \
|
||||
if [ "HEAD" != $(git rev-parse --abbrev-ref HEAD) ]; then \
|
||||
echo $(git rev-parse --abbrev-ref HEAD); \
|
||||
elif [ -n "$BRANCH_NAME" ]; then \
|
||||
echo $BRANCH_NAME; \
|
||||
else \
|
||||
echo $(git name-rev --name-only HEAD); \
|
||||
fi)
|
||||
WORKDIR /opt/holmes
|
||||
EOF
|
42
Jenkinsfile
vendored
42
Jenkinsfile
vendored
@ -1,42 +0,0 @@
|
||||
#!groovy
|
||||
|
||||
build('image-holmes', 'docker-host') {
|
||||
checkoutRepo()
|
||||
loadBuildUtils()
|
||||
|
||||
def pipeDefault
|
||||
runStage('load pipeline') {
|
||||
env.JENKINS_LIB = "build_utils/jenkins_lib"
|
||||
pipeDefault = load("${env.JENKINS_LIB}/pipeDefault.groovy")
|
||||
}
|
||||
|
||||
pipeDefault() {
|
||||
runStage('fetch submodules') {
|
||||
withGithubPrivkey {
|
||||
sh 'make submodules'
|
||||
}
|
||||
}
|
||||
|
||||
runStage('compile scripts') {
|
||||
withGithubPrivkey {
|
||||
sh 'make wc_lib'
|
||||
}
|
||||
}
|
||||
|
||||
runStage('build image') {
|
||||
sh 'make build_image'
|
||||
}
|
||||
|
||||
try {
|
||||
if (env.BRANCH_NAME == 'master' || env.BRANCH_NAME.startsWith('epic')) {
|
||||
runStage('push image') {
|
||||
sh 'make push_image'
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
runStage('rm local image') {
|
||||
sh 'make rm_local_image'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
29
Makefile
29
Makefile
@ -1,31 +1,6 @@
|
||||
UTILS_PATH := build_utils
|
||||
TEMPLATES_PATH := .
|
||||
.PHONY: lib
|
||||
|
||||
# Name of the service
|
||||
SERVICE_NAME := holmes
|
||||
# Service image default tag
|
||||
SERVICE_IMAGE_TAG ?= $(shell git rev-parse HEAD)
|
||||
# The tag for service image to be pushed with
|
||||
SERVICE_IMAGE_PUSH_TAG ?= $(SERVICE_IMAGE_TAG)
|
||||
|
||||
# Base image for the service
|
||||
BASE_IMAGE_NAME := build
|
||||
BASE_IMAGE_TAG := accaf81566fd3ad14bc6eadb26375ca83e76038f
|
||||
|
||||
# Build image tag to be used
|
||||
BUILD_IMAGE_TAG := accaf81566fd3ad14bc6eadb26375ca83e76038f
|
||||
|
||||
CALL_ANYWHERE := all submodules lib
|
||||
|
||||
# Hint: 'test' might be a candidate for CALL_W_CONTAINER-only target
|
||||
CALL_W_CONTAINER := $(CALL_ANYWHERE)
|
||||
|
||||
.PHONY: $(CALL_W_CONTAINER)
|
||||
|
||||
all: submodules
|
||||
|
||||
-include $(UTILS_PATH)/make_lib/utils_container.mk
|
||||
-include $(UTILS_PATH)/make_lib/utils_image.mk
|
||||
all: submodules lib
|
||||
|
||||
submodules:
|
||||
@if git submodule status | egrep -q '^[-]|^[+]'; then git submodule update --init; fi
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit dfe271b09a2b8e457f50e4732b905a0b846bf529
|
||||
Subproject commit 38ce3ffde52fb2f52a8d042e67a3e2715adb7546
|
@ -1 +1 @@
|
||||
Subproject commit 410b2c241d199e3cd42a9b8b553e8aa645d6ff19
|
||||
Subproject commit 9db92d90e0e28953cdb1b30c719edb529aa86579
|
@ -1 +0,0 @@
|
||||
Subproject commit e1318727d4d0c3e48f5122bf3197158b6695f50e
|
1
cds-proto
Submodule
1
cds-proto
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit ed9f9078049ebcd1439d2ada0479fc8f33ccacf1
|
@ -1 +0,0 @@
|
||||
Subproject commit 07f2b0f2e61d94b5fd93c40106525a9777d3398e
|
43
clone-proto-modules.sh
Executable file
43
clone-proto-modules.sh
Executable file
@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
|
||||
PROTO_MODULE_RE='(damsel|[a-z]+-proto)'
|
||||
GIT_OPTIONS='-c advice.detachedHead=false -c init.defaultBranch=master'
|
||||
|
||||
TARGET_DIR="$1"
|
||||
[ -z "$TARGET_DIR" ] && {
|
||||
echo "usage: $0 <target-dir>"
|
||||
exit -1
|
||||
}
|
||||
|
||||
function enumerate_proto_modules {
|
||||
git ls-files --error-unmatch --stage \
|
||||
| grep '^160000' \
|
||||
| awk '{ print $4 " " $2; }' \
|
||||
| grep -E "$PROTO_MODULE_RE"
|
||||
}
|
||||
|
||||
function emit_clone_command {
|
||||
local name="$1"
|
||||
local sha1="$2"
|
||||
local branch="$(git config -f .gitmodules --get "submodule.${name}.branch")"
|
||||
local url="$(git config -f .gitmodules --get "submodule.${name}.url")"
|
||||
local target="${TARGET_DIR}/${name}"
|
||||
local git="git ${GIT_OPTIONS} -C ${target}"
|
||||
|
||||
mkdir -p "${target}"
|
||||
$git init
|
||||
$git remote add origin "${url}"
|
||||
$git fetch origin "${sha1}"
|
||||
if [ -n "${branch}" ]; then
|
||||
$git fetch origin "${branch}"
|
||||
$git checkout -B "${branch}" "${sha1}"
|
||||
$git branch --set-upstream-to "origin/${branch}"
|
||||
else
|
||||
$git checkout "${sha1}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
enumerate_proto_modules | while read name sha1; do
|
||||
emit_clone_command $name $sha1
|
||||
done
|
2
damsel
2
damsel
@ -1 +1 @@
|
||||
Subproject commit b7f092ef41db810b79c03ad4f1f229d79091e172
|
||||
Subproject commit d384c125d16c0204e23b0d96a6ef791244a72315
|
1
fistful-proto
Submodule
1
fistful-proto
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit c45166d018d36a75452c3007f704e8fd3ad1056c
|
12
lib/Makefile
12
lib/Makefile
@ -1,11 +1,11 @@
|
||||
REBAR := $(shell which rebar3 2>/dev/null || which ./rebar3)
|
||||
REBAR := rebar3
|
||||
RELDIR := $(CURDIR)/scripts
|
||||
|
||||
.PHONY: all observer_cli
|
||||
.PHONY: all
|
||||
|
||||
all: observer_cli
|
||||
all: $(RELDIR)/observer-cli
|
||||
|
||||
observer_cli:
|
||||
cd $@ && $(REBAR) as inet6 escriptize
|
||||
$(RELDIR)/observer-cli: observer_cli
|
||||
cd $< && $(REBAR) escriptize
|
||||
mkdir -p $(RELDIR)
|
||||
cp $@/_build/inet6/bin/observer_cli $(RELDIR)/observer-cli
|
||||
cp $</_build/default/bin/observer_cli $(RELDIR)/observer-cli
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 90c441b44169fdfd5c9adda40949c35a92bdf6aa
|
||||
Subproject commit 373cd66cf5b05240f807a70edf4fd0528cdf5ff9
|
@ -1 +1 @@
|
||||
Subproject commit 9c0653ff7281ff443f515d2fddf9673fe837a5be
|
||||
Subproject commit 8c08550746ad7c71d57ea2435ccfbb92b4ea48e0
|
1
machinegun-proto
Submodule
1
machinegun-proto
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit af57ba12be76a6e7645405c52ce8d3fcdde9ce44
|
1
mgproto
1
mgproto
@ -1 +0,0 @@
|
||||
Subproject commit d814d6948d4ff13f6f41d12c6613f59c805750b2
|
@ -1 +1 @@
|
||||
Subproject commit ec15d5e854ea60c58467373077d90c2faf6273d8
|
||||
Subproject commit 8742c7aa09eb28a95a1a3dadb8b00670851d99e8
|
@ -21,7 +21,7 @@ function usage {
|
||||
echo -e " $(em minimum) Minimum ID (number). The newly generated id would be equals to or bigger than the specified value."
|
||||
echo
|
||||
echo -e "More information:"
|
||||
echo -e " https://github.com/rbkmoney/bender-proto/blob/master/proto/bender.thrift"
|
||||
echo -e " https://github.com/valitydev/bender-proto/blob/master/proto/bender.thrift"
|
||||
exit $1
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ def call_keyring(cds_address, func, *args):
|
||||
json_args = [json.dumps(arg) for arg in args]
|
||||
woorl_args = \
|
||||
[
|
||||
"woorl", "-s", "cds_proto/proto/keyring.thrift",
|
||||
"woorl", "-s", "cds-proto/proto/keyring.thrift",
|
||||
"http://{}:{}/v2/keyring".format(cds_address, thrift_port),
|
||||
"KeyringManagement", func
|
||||
] + json_args
|
||||
|
@ -21,11 +21,10 @@ function usage {
|
||||
echo -e " $(em reason) Reason (string), $(em "Refunded manually") by default."
|
||||
echo
|
||||
echo -e "More information:"
|
||||
echo -e " https://github.com/rbkmoney/damsel/blob/master/proto/payment_processing.thrift"
|
||||
echo -e " https://github.com/valitydev/damsel/blob/master/proto/payment_processing.thrift"
|
||||
exit 127
|
||||
}
|
||||
|
||||
USERINFO=$(jq -nc "{id:\"${SCRIPTNAME}\", type:{service_user:{}}}")
|
||||
INVOICE_ID="${1}"
|
||||
PAYMENT_ID="${2}"
|
||||
AMOUNT="${3}"
|
||||
@ -54,4 +53,4 @@ fi
|
||||
"${WOORL[@]:-woorl}" \
|
||||
-s "${DAMSEL}/proto/payment_processing.thrift" \
|
||||
"http://${HELLGATE:-hellgate}:8022/v1/processing/invoicing" \
|
||||
Invoicing CreateManualRefund "${USERINFO}" "\"${INVOICE_ID}\"" "\"${PAYMENT_ID}\"" "${PARAMS}"
|
||||
Invoicing CreateManualRefund "\"${INVOICE_ID}\"" "\"${PAYMENT_ID}\"" "${PARAMS}"
|
||||
|
@ -18,7 +18,7 @@ case "$1" in
|
||||
echo -e " -h, --help help"
|
||||
echo
|
||||
echo -e "More information:"
|
||||
echo -e " https://github.com/rbkmoney/damsel/blob/a603319/proto/payment_processing.thrift"
|
||||
echo -e " https://github.com/valitydev/damsel/blob/master/proto/domain_config.thrift"
|
||||
exit 0
|
||||
;;
|
||||
* )
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
CWD="$(dirname $0)"
|
||||
MGPROTO="${CWD}/../mgproto"
|
||||
MGPROTO="${CWD}/../machinegun-proto"
|
||||
|
||||
USAGE=$(cat <<EOF
|
||||
Usage: ${SCRIPTNAME} id [ns]
|
||||
@ -12,7 +12,7 @@ Usage: ${SCRIPTNAME} id [ns]
|
||||
ns Machine namespace (string, default = invoice)
|
||||
|
||||
More information:
|
||||
https://github.com/rbkmoney/machinegun_proto
|
||||
https://github.com/valitydev/machinegun-proto
|
||||
EOF
|
||||
)
|
||||
|
||||
|
@ -14,8 +14,8 @@ Usage: ${SCRIPTNAME} plan-id batch-id
|
||||
batch-id Posting batch ID (string)
|
||||
|
||||
More information:
|
||||
[1]: https://github.com/rbkmoney/damsel
|
||||
[2]: https://github.com/rbkmoney/damsel/blob/b0806eb1/proto/accounter.thrift#L67
|
||||
[1]: https://github.com/valitydev/damsel
|
||||
[2]: https://github.com/valitydev/damsel/blob/d384c125/proto/accounter.thrift#L70
|
||||
EOF
|
||||
)
|
||||
|
||||
|
@ -13,8 +13,8 @@ Usage: ${SCRIPTNAME} plan-id
|
||||
plan-id Posting plan ID (string)
|
||||
|
||||
More information:
|
||||
[1]: https://github.com/rbkmoney/damsel
|
||||
[2]: https://github.com/rbkmoney/damsel/blob/b0806eb1/proto/accounter.thrift#L67
|
||||
[1]: https://github.com/valitydev/damsel
|
||||
[2]: https://github.com/valitydev/damsel/blob/d384c125/proto/accounter.thrift#L70
|
||||
EOF
|
||||
)
|
||||
|
||||
@ -31,4 +31,4 @@ PLANID="${1}"
|
||||
ACCOUNTER="http://${SHUMWAY:-shumway}:${SHUMWAY_PORT:-8022}/accounter"
|
||||
|
||||
"${WOORL[@]:-woorl}" -s "${DAMSEL}/proto/accounter.thrift" \
|
||||
"${ACCOUNTER}" Accounter GetPlan "\"${PLANID}\""
|
||||
"${ACCOUNTER}" Accounter GetPlan "\"${PLANID}\""
|
||||
|
@ -11,7 +11,7 @@ get_events () {
|
||||
"${WOORL[@]:-woorl}" \
|
||||
-s "${DAMSEL}/proto/payment_processing.thrift" \
|
||||
"http://${HELLGATE:-hellgate}:8022/v1/processing/invoicing" \
|
||||
Invoicing GetEvents "$1" "$2" "$3"
|
||||
Invoicing GetEvents "$1" "$2"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
@ -26,11 +26,10 @@ case "$1" in
|
||||
echo -e " -h, --help Show this help message."
|
||||
echo
|
||||
echo -e "More information:"
|
||||
echo -e " https://github.com/rbkmoney/damsel/blob/a603319/proto/payment_processing.thrift"
|
||||
echo -e " https://github.com/valitydev/damsel/blob/2e1dbc1a/proto/payment_processing.thrift#L1054-L1059"
|
||||
exit 0
|
||||
;;
|
||||
* )
|
||||
USERINFO="{\"id\":\"${SCRIPTNAME}\",\"type\":{\"service_user\":{}}}"
|
||||
INVOICE_ID="\"$1\""
|
||||
shift 1
|
||||
if [ -n "$1" ]; then
|
||||
@ -46,6 +45,6 @@ case "$1" in
|
||||
else
|
||||
RANGE="{\"limit\":${LIMIT}}"
|
||||
fi
|
||||
get_events "$USERINFO" "$INVOICE_ID" "$RANGE" "$*"
|
||||
get_events "$INVOICE_ID" "$RANGE"
|
||||
;;
|
||||
esac
|
||||
|
@ -11,7 +11,7 @@ get_state () {
|
||||
"${WOORL[@]:-woorl}" \
|
||||
-s "${DAMSEL}/proto/payment_processing.thrift" \
|
||||
"http://${HELLGATE:-hellgate}:8022/v1/processing/invoicing" \
|
||||
Invoicing Get "$1" "$2" "{}"
|
||||
Invoicing Get "$1" "{}"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
@ -23,13 +23,12 @@ case "$1" in
|
||||
echo -e " -h, --help Show this help message."
|
||||
echo
|
||||
echo -e "More information:"
|
||||
echo -e " https://github.com/rbkmoney/damsel/blob/a603319/proto/payment_processing.thrift"
|
||||
echo -e " https://github.com/valitydev/damsel/blob/2e1dbc1a/proto/payment_processing.thrift#L1049-L1052"
|
||||
exit 0
|
||||
;;
|
||||
* )
|
||||
USERINFO="{\"id\":\"${SCRIPTNAME}\",\"type\":{\"service_user\":{}}}"
|
||||
INVOICE_ID="\"$1\""
|
||||
shift 1
|
||||
get_state "$USERINFO" "$INVOICE_ID"
|
||||
get_state "$INVOICE_ID"
|
||||
;;
|
||||
esac
|
||||
|
@ -8,10 +8,10 @@ DAMSEL="${CWD}/../../damsel"
|
||||
SCRIPTNAME=$(basename $0)
|
||||
|
||||
get_events () {
|
||||
"${WOORL[@]:-woorl}" $4 \
|
||||
"${WOORL[@]:-woorl}" $3 \
|
||||
-s "${DAMSEL}/proto/payment_processing.thrift" \
|
||||
"http://${HELLGATE:-hellgate}:8022/v1/processing/partymgmt" \
|
||||
PartyManagement GetEvents "$1" "$2" "$3"
|
||||
PartyManagement GetEvents "$1" "$2"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
@ -26,11 +26,10 @@ case "$1" in
|
||||
echo -e " -h, --help help"
|
||||
echo
|
||||
echo -e "More information:"
|
||||
echo -e " https://github.com/rbkmoney/damsel/blob/a603319/proto/payment_processing.thrift"
|
||||
echo -e " https://github.com/valitydev/damsel/blob/2e1dbc1a/proto/payment_processing.thrift#L2646-L2651"
|
||||
exit 0
|
||||
;;
|
||||
* )
|
||||
USERINFO="{\"id\":\"${SCRIPTNAME}\",\"type\":{\"service_user\":{}}}"
|
||||
PARTY_ID="\"$1\""
|
||||
shift 1
|
||||
LIMIT="$1"
|
||||
@ -41,6 +40,6 @@ case "$1" in
|
||||
else
|
||||
RANGE="{\"limit\":${LIMIT}}"
|
||||
fi
|
||||
get_events "$USERINFO" "$PARTY_ID" "$RANGE" "$*"
|
||||
get_events "$PARTY_ID" "$RANGE" "$*"
|
||||
;;
|
||||
esac
|
||||
|
@ -8,10 +8,10 @@ DAMSEL="${CWD}/../../damsel"
|
||||
SCRIPTNAME=$(basename $0)
|
||||
|
||||
get_party () {
|
||||
"${WOORL[@]:-woorl}" $3 \
|
||||
"${WOORL[@]:-woorl}" $2 \
|
||||
-s "${DAMSEL}/proto/payment_processing.thrift" \
|
||||
"http://${HELLGATE:-hellgate}:8022/v1/processing/partymgmt" \
|
||||
PartyManagement Get "$1" "$2"
|
||||
PartyManagement Get "$1"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
@ -23,13 +23,12 @@ case "$1" in
|
||||
echo -e " -h, --help Show this help message."
|
||||
echo
|
||||
echo -e "More information:"
|
||||
echo -e " https://github.com/rbkmoney/damsel/blob/a603319/proto/payment_processing.thrift"
|
||||
echo -e " https://github.com/valitydev/damsel/blob/2e1dbc1a/proto/payment_processing.thrift#L2494-L2495"
|
||||
exit 0
|
||||
;;
|
||||
* )
|
||||
USERINFO="{\"id\":\"${SCRIPTNAME}\",\"type\":{\"service_user\":{}}}"
|
||||
PARTY_ID="\"$1\""
|
||||
shift 1
|
||||
get_party "$USERINFO" "$PARTY_ID" "$*"
|
||||
get_party "$PARTY_ID" "$*"
|
||||
;;
|
||||
esac
|
||||
|
@ -1,13 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Just `source` it in your favourite shell
|
||||
|
||||
CONSUL="http://consul1.bst1.rbkmoney.net:8500"
|
||||
|
||||
function discover {
|
||||
curl -s "${CONSUL}/v1/catalog/service/${1}" | jq -r '.[0].ServiceAddress'
|
||||
}
|
||||
|
||||
echo "export MACHINEGUN=[$(discover 'machinegun')]"
|
||||
echo "export HELLGATE=[$(discover 'hellgate')]"
|
||||
echo "export SHUMWAY=[$(discover 'shumway')]"
|
@ -27,7 +27,7 @@ USAGE=$(cat <<EOF
|
||||
$(em --subtraction) Limiter behaviour when process payment refund. After refund limit will decrease on refund amount.
|
||||
|
||||
More information:
|
||||
https://github.com/rbkmoney/limiter-proto/blob/master/proto/configurator.thrift
|
||||
https://github.com/valitydev/limiter-proto/blob/master/proto/configurator.thrift
|
||||
EOF
|
||||
)
|
||||
|
@ -18,7 +18,7 @@ USAGE=$(cat <<EOF
|
||||
$(em id) Limit config ID (string)
|
||||
|
||||
More information:
|
||||
https://github.com/rbkmoney/limiter-proto/blob/master/proto/configurator.thrift
|
||||
https://github.com/valitydev/limiter-proto/blob/master/proto/configurator.thrift
|
||||
EOF
|
||||
)
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
CWD="$(dirname $0)"
|
||||
MGPROTO="${CWD}/../../mgproto"
|
||||
MGPROTO="${CWD}/../../machinegun-proto"
|
||||
|
||||
[ -f woorlrc ] && source woorlrc
|
||||
|
||||
|
@ -23,7 +23,7 @@ case ${INVOICE} in
|
||||
echo -e " -h, --help Show this help message."
|
||||
echo
|
||||
echo -e "More information:"
|
||||
echo -e " https://github.com/rbkmoney/damsel/blob/master/proto/payment_processing.thrift"
|
||||
echo -e " https://github.com/valitydev/damsel/blob/master/proto/payment_processing.thrift"
|
||||
exit 0
|
||||
;;
|
||||
* )
|
||||
|
@ -20,7 +20,7 @@ case ${INVOICE} in
|
||||
echo -e " -h, --help Show this help message."
|
||||
echo
|
||||
echo -e "More information:"
|
||||
echo -e " https://github.com/rbkmoney/damsel/blob/master/proto/payment_processing.thrift"
|
||||
echo -e " https://github.com/valitydev/damsel/blob/master/proto/payment_processing.thrift"
|
||||
exit 0
|
||||
;;
|
||||
* )
|
||||
|
@ -26,7 +26,7 @@ case ${INVOICE} in
|
||||
echo -e " -h, --help Show this help message."
|
||||
echo
|
||||
echo -e "More information:"
|
||||
echo -e " https://github.com/rbkmoney/damsel/blob/master/proto/payment_processing.thrift"
|
||||
echo -e " https://github.com/valitydev/damsel/blob/master/proto/payment_processing.thrift"
|
||||
exit 0
|
||||
;;
|
||||
* )
|
||||
|
@ -28,7 +28,7 @@ case ${INVOICE} in
|
||||
echo -e " -h, --help Show this help message."
|
||||
echo
|
||||
echo -e "More information:"
|
||||
echo -e " https://github.com/rbkmoney/damsel/blob/master/proto/payment_processing.thrift"
|
||||
echo -e " https://github.com/valitydev/damsel/blob/master/proto/payment_processing.thrift"
|
||||
exit 0
|
||||
;;
|
||||
* )
|
||||
|
@ -28,7 +28,7 @@ case ${INVOICE} in
|
||||
echo -e " -h, --help Show this help message."
|
||||
echo
|
||||
echo -e "More information:"
|
||||
echo -e " https://github.com/rbkmoney/damsel/blob/master/proto/payment_processing.thrift"
|
||||
echo -e " https://github.com/valitydev/damsel/blob/master/proto/payment_processing.thrift"
|
||||
exit 0
|
||||
;;
|
||||
* )
|
||||
|
@ -24,7 +24,7 @@ case ${INVOICE} in
|
||||
echo -e " -h, --help Show this help message."
|
||||
echo
|
||||
echo -e "More information:"
|
||||
echo -e " https://github.com/rbkmoney/damsel/blob/master/proto/payment_processing.thrift"
|
||||
echo -e " https://github.com/valitydev/damsel/blob/master/proto/payment_processing.thrift"
|
||||
exit 0
|
||||
;;
|
||||
* )
|
||||
|
@ -33,7 +33,7 @@ function usage {
|
||||
echo -e " -h, --help Show this help message."
|
||||
echo
|
||||
echo -e "More information:"
|
||||
echo -e " https://github.com/rbkmoney/damsel/blob/master/proto/payment_processing.thrift"
|
||||
echo -e " https://github.com/valitydev/damsel/blob/master/proto/payment_processing.thrift"
|
||||
exit 127
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ function usage {
|
||||
echo -e " $(em refund_id) Refund ID (string), last one by default."
|
||||
echo
|
||||
echo -e "More information:"
|
||||
echo -e " https://github.com/rbkmoney/damsel/blob/master/proto/payment_processing.thrift"
|
||||
echo -e " https://github.com/valitydev/damsel/blob/master/proto/payment_processing.thrift"
|
||||
exit 127
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ function usage {
|
||||
# echo -e " $(em currency) Currency code (string)."
|
||||
echo
|
||||
echo -e "More information:"
|
||||
echo -e " https://github.com/rbkmoney/damsel/blob/master/proto/payment_processing.thrift"
|
||||
echo -e " https://github.com/valitydev/damsel/blob/master/proto/payment_processing.thrift"
|
||||
exit 127
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ case ${INVOICE} in
|
||||
echo -e " -h, --help Show this help message."
|
||||
echo
|
||||
echo -e "More information:"
|
||||
echo -e " https://github.com/rbkmoney/damsel/blob/master/proto/payment_processing.thrift"
|
||||
echo -e " https://github.com/valitydev/damsel/blob/master/proto/payment_processing.thrift"
|
||||
exit 0
|
||||
;;
|
||||
* )
|
||||
|
@ -24,7 +24,7 @@ case ${INVOICE} in
|
||||
echo -e " -h, --help Show this help message."
|
||||
echo
|
||||
echo -e "More information:"
|
||||
echo -e " https://github.com/rbkmoney/damsel/blob/master/proto/payment_processing.thrift"
|
||||
echo -e " https://github.com/valitydev/damsel/blob/master/proto/payment_processing.thrift"
|
||||
exit 0
|
||||
;;
|
||||
* )
|
||||
|
@ -88,8 +88,6 @@ def mk_change_contractor(contract_id, contractor_id):
|
||||
}
|
||||
|
||||
|
||||
userinfo = {'id': 'woorl', 'type': {'service_user': {}}}
|
||||
|
||||
partymgmt_url = 'http://{host}:{port}/v1/processing/partymgmt'.format(
|
||||
host=os.environ.get('HELLGATE', 'hellgate'),
|
||||
port=os.environ.get('HELLGATE_PORT', 8022)
|
||||
@ -128,7 +126,6 @@ def migrate_party(party_id):
|
||||
claim = json.loads(woorl(
|
||||
'-s', '../damsel/ebin/dmsl_payment_processing_thrift.beam',
|
||||
partymgmt_url, 'PartyManagement', 'CreateClaim',
|
||||
json.dumps(userinfo),
|
||||
json.dumps(party_id),
|
||||
json.dumps(changeset),
|
||||
dry_run_result='{"id":42, "revision":1}'
|
||||
@ -139,7 +136,6 @@ def migrate_party(party_id):
|
||||
woorl(
|
||||
'-s', '../damsel/ebin/dmsl_payment_processing_thrift.beam',
|
||||
partymgmt_url, 'PartyManagement', 'AcceptClaim',
|
||||
json.dumps(userinfo),
|
||||
json.dumps(party_id),
|
||||
json.dumps(claim['id']),
|
||||
json.dumps(claim['revision'])
|
||||
|
@ -18,7 +18,7 @@ function usage {
|
||||
echo -e " $(em currency) Currency code (string)."
|
||||
echo
|
||||
echo -e "More information:"
|
||||
echo -e " https://github.com/rbkmoney/damsel/blob/master/proto/payment_processing.thrift"
|
||||
echo -e " https://github.com/valitydev/damsel/blob/master/proto/payment_processing.thrift"
|
||||
exit 127
|
||||
}
|
||||
|
||||
@ -30,11 +30,10 @@ CURCODE="${4}"
|
||||
[ -z "${INVOICE}" -o -z "${PAYMENT}" -o -z "${AMOUNT}" -o -z "${CURCODE}" ] && usage
|
||||
|
||||
PARAMS=$(jq -nc "{cash:{amount:${AMOUNT}, currency:{symbolic_code:\"${CURCODE}\"}}}")
|
||||
USERINFO=$(jq -nc "{id:\"${SCRIPTNAME}\", type:{service_user:{}}}")
|
||||
|
||||
[ -f woorlrc ] && source woorlrc
|
||||
|
||||
"${WOORL[@]:-woorl}" \
|
||||
-s "${DAMSEL}/proto/payment_processing.thrift" \
|
||||
"http://${HELLGATE:-hellgate}:8022/v1/processing/invoicing" \
|
||||
Invoicing RefundPayment "${USERINFO}" "\"${INVOICE}\"" "\"${PAYMENT}\"" "${PARAMS}"
|
||||
Invoicing RefundPayment "\"${INVOICE}\"" "\"${PAYMENT}\"" "${PARAMS}"
|
||||
|
@ -17,7 +17,7 @@ Usage: ${SCRIPTNAME} [--force] [--set-timeout SEC | --set-deadline TS | --unset-
|
||||
--force To force appending changeset (which in effect turns state transitions validation off)
|
||||
|
||||
More information:
|
||||
https://github.com/rbkmoney/damsel
|
||||
https://github.com/valitydev/damsel/blob/2e1dbc1a/proto/payment_processing.thrift#L1457-L1466
|
||||
EOF
|
||||
)
|
||||
|
||||
@ -53,9 +53,7 @@ INVOICE_CHANGES="${2}"
|
||||
|
||||
[ -f woorlrc ] && source woorlrc
|
||||
|
||||
USERINFO='{"id":"woorl","type":{"service_user":{}}}'
|
||||
|
||||
"${WOORL[@]:-woorl}" \
|
||||
-s "${DAMSEL}/proto/payment_processing.thrift" \
|
||||
"http://${HELLGATE:-hellgate}:8022/v1/processing/invoicing" \
|
||||
Invoicing Repair "${USERINFO}" "\"${INVOICE}\"" "${INVOICE_CHANGES}" "${ACTION}" "${PARAMS}"
|
||||
Invoicing Repair "\"${INVOICE}\"" "${INVOICE_CHANGES}" "${ACTION}" "${PARAMS}"
|
||||
|
@ -11,8 +11,8 @@ Usage: ${SCRIPTNAME} plan-id batch
|
||||
batch Posting batch (json object, see [2])
|
||||
|
||||
More information:
|
||||
[1]: https://github.com/rbkmoney/damsel
|
||||
[2]: https://github.com/rbkmoney/damsel/blob/b0806eb1/proto/accounter.thrift#L67
|
||||
[1]: https://github.com/valitydev/damsel
|
||||
[2]: https://github.com/valitydev/damsel/blob/d384c125/proto/accounter.thrift#L70
|
||||
EOF
|
||||
)
|
||||
|
||||
|
@ -15,8 +15,8 @@ Usage: ${SCRIPTNAME} plan-id batch
|
||||
batch Posting batch (json object, see [2])
|
||||
|
||||
More information:
|
||||
[1]: https://github.com/rbkmoney/damsel
|
||||
[2]: https://github.com/rbkmoney/damsel/blob/b0806eb1/proto/accounter.thrift#L67
|
||||
[1]: https://github.com/valitydev/damsel
|
||||
[2]: https://github.com/valitydev/damsel/blob/d384c125/proto/accounter.thrift#L70
|
||||
EOF
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user