TD-222: Reuse valitydev/action-deploy-docker@v2 (#16)

* Use valitydev/thrift compiler v0.14.2.3
* Switch to valitydev/machinery-erlang@62c3243
* Bump to valitydev/bender-proto@71c5687
* Bump to valitydev/machinegun-proto@a411c7d
This commit is contained in:
Andrew Mayorov 2022-07-12 15:53:51 +03:00 committed by GitHub
parent 5ae065505e
commit 21c002a14b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 42 additions and 121 deletions

4
.env
View File

@ -3,6 +3,6 @@
# You SHOULD specify point releases here so that build time and run time Erlang/OTPs
# are the same. See: https://github.com/erlware/relx/pull/902
SERVICE_NAME=bender
OTP_VERSION=24.2.0
OTP_VERSION=24.3.4
REBAR_VERSION=3.18
THRIFT_VERSION=0.14.2.2
THRIFT_VERSION=0.14.2.3

View File

@ -1,54 +0,0 @@
name: Build and push Docker image
on:
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:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
OTP_VERSION=${{ env.OTP_VERSION }}
THRIFT_VERSION=${{ env.THRIFT_VERSION }}
SERVICE_NAME=${{ env.SERVICE_NAME }}

View File

@ -1,43 +1,21 @@
name: Build Docker image
name: Build and publish Docker image
on:
push:
branches:
- 'master'
- 'epic/**'
pull_request:
branches: ["*"]
branches: ['**']
env:
REGISTRY: ghcr.io
jobs:
build:
build-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Construct tags / labels for an image
id: meta
uses: docker/metadata-action@v3
- uses: valitydev/action-deploy-docker@v2
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: Setup Buildx
uses: docker/setup-buildx-action@v1
- name: Build Docker image
uses: docker/build-push-action@v2
with:
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
OTP_VERSION=${{ env.OTP_VERSION }}
THRIFT_VERSION=${{ env.THRIFT_VERSION }}
SERVICE_NAME=${{ env.SERVICE_NAME }}
registry-username: ${{ github.actor }}
registry-access-token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -91,11 +91,11 @@ get_handler_spec() ->
GeneratorPath = maps:get(generator_path, Generator, <<"/v1/generator">>),
[
{BenderPath, {
{bender_thrift, 'Bender'},
{bender_bender_thrift, 'Bender'},
bender_handler
}},
{GeneratorPath, {
{bender_thrift, 'Generator'},
{bender_bender_thrift, 'Generator'},
generator_handler
}}
].

View File

@ -19,7 +19,7 @@
-type internal_id() :: binary() | {binary(), pos_integer()}.
-type schema() :: bender:schema().
-type user_context() :: msgpack_thrift:'Value'() | undefined.
-type user_context() :: msgp_msgpack_thrift:'Value'() | undefined.
-type state() :: #{
internal_id := internal_id(),
user_context := user_context()

View File

@ -6,17 +6,17 @@
-export([handle_function/4]).
-include_lib("bender_proto/include/bender_thrift.hrl").
-include_lib("bender_proto/include/bender_bender_thrift.hrl").
-include("bender_internal.hrl").
-type woody_context() :: woody_context:ctx().
-type external_id() :: bender_thrift:'ExternalID'().
-type external_id() :: bender_bender_thrift:'ExternalID'().
-type schema() :: bender:schema().
-type user_context() :: msgpack_thrift:'Value'().
-type generate_id_result() :: bender_thrift:'GenerationResult'().
-type get_internal_id_result() :: bender_thrift:'GetInternalIDResult'().
-type user_context() :: msgp_msgpack_thrift:'Value'().
-type generate_id_result() :: bender_bender_thrift:'GenerationResult'().
-type get_internal_id_result() :: bender_bender_thrift:'GetInternalIDResult'().
-spec handle_function(woody:func(), woody:args(), woody_context(), woody:options()) -> {ok, woody:result()}.
handle_function(Func, Args, WoodyCtx, Opts) ->
@ -37,7 +37,7 @@ handle_function_('GetInternalID', {ExternalID}, WoodyCtx, _Opts) ->
}),
get_internal_id(ExternalID, WoodyCtx).
-spec generate_id(external_id(), bender_thrift:'GenerationSchema'(), user_context(), woody_context()) ->
-spec generate_id(external_id(), bender_bender_thrift:'GenerationSchema'(), user_context(), woody_context()) ->
{ok, generate_id_result()} | no_return().
generate_id(ExternalID, {constant, #bender_ConstantSchema{} = Schema}, UserCtx, WoodyCtx) ->
NewInternalID = Schema#bender_ConstantSchema.internal_id,

View File

@ -2,7 +2,7 @@
-define(__BENDER_INTERNAL_HRL__, included).
-record(constant, {
internal_id :: bender_thrift:'InternalID'()
internal_id :: bender_bender_thrift:'InternalID'()
}).
-record(sequence, {

View File

@ -6,14 +6,14 @@
-export([handle_function/4]).
-include_lib("bender_proto/include/bender_thrift.hrl").
-include_lib("bender_proto/include/bender_bender_thrift.hrl").
-include("bender_internal.hrl").
-type woody_context() :: woody_context:ctx().
-type schema() :: bender:schema().
-type generate_id_result() :: bender_thrift:'GeneratedID'().
-type generate_id_result() :: bender_bender_thrift:'GeneratedID'().
-spec handle_function(woody:func(), woody:args(), woody_context(), woody:options()) -> {ok, woody:result()}.
handle_function(Func, Args, WoodyCtx, Opts) ->
@ -26,7 +26,8 @@ handle_function(Func, Args, WoodyCtx, Opts) ->
handle_function_('GenerateID', {Schema}, WoodyCtx, _Opts) ->
generate_id(Schema, WoodyCtx).
-spec generate_id(bender_thrift:'GenerationSchema'(), woody_context()) -> {ok, generate_id_result()} | no_return().
-spec generate_id(bender_bender_thrift:'GenerationSchema'(), woody_context()) ->
{ok, generate_id_result()} | no_return().
generate_id({constant, #bender_ConstantSchema{} = Schema}, WoodyCtx) ->
NewInternalID = Schema#bender_ConstantSchema.internal_id,
Constant = #constant{internal_id = NewInternalID},

View File

@ -6,9 +6,9 @@
-type client() :: woody_context:ctx().
-type external_id() :: bender_thrift:'ExternalID'().
-type schema() :: bender_thrift:'GenerationSchema'().
-type user_context() :: msgpack_thrift:'Value'().
-type external_id() :: bender_bender_thrift:'ExternalID'().
-type schema() :: bender_bender_thrift:'GenerationSchema'().
-type user_context() :: msgp_msgpack_thrift:'Value'().
-define(RETRY_STATEGY, genlib_retry:linear(5, 1000)).
@ -30,7 +30,7 @@ get_internal_id(ExternalID, Client) ->
-spec call(atom(), tuple(), client()) -> woody:result() | no_return().
call(Function, Args, Client) ->
Call = {{bender_thrift, 'Bender'}, Function, Args},
Call = {{bender_bender_thrift, 'Bender'}, Function, Args},
Opts = #{
url => <<"http://bender:8022/v1/bender">>,
event_handler => scoper_woody_event_handler,

View File

@ -1,7 +1,5 @@
-module(bender_tests_SUITE).
-include_lib("common_test/include/ct.hrl").
-export([all/0]).
-export([groups/0]).
-export([init_per_suite/1]).
@ -21,7 +19,7 @@
-export([retrieve_unknown_id/1]).
-export([retrieve_known_id/1]).
-include_lib("bender_proto/include/bender_thrift.hrl").
-include_lib("bender_proto/include/bender_bender_thrift.hrl").
-type config() :: [{atom(), term()}].
-type group_name() :: atom().

View File

@ -5,7 +5,7 @@
-type client() :: woody_context:ctx().
-type schema() :: bender_thrift:'GenerationSchema'().
-type schema() :: bender_bender_thrift:'GenerationSchema'().
-define(RETRY_STATEGY, genlib_retry:linear(5, 1000)).
@ -23,7 +23,7 @@ generate_id(Schema, Client) ->
-spec call(atom(), tuple(), client()) -> woody:result() | no_return().
call(Function, Args, Client) ->
Call = {{bender_thrift, 'Generator'}, Function, Args},
Call = {{bender_bender_thrift, 'Generator'}, Function, Args},
Opts = #{
url => <<"http://bender:8022/v1/generator">>,
event_handler => scoper_woody_event_handler,

View File

@ -1,7 +1,5 @@
-module(generator_tests_SUITE).
-include_lib("common_test/include/ct.hrl").
-export([all/0]).
-export([groups/0]).
-export([init_per_suite/1]).
@ -14,7 +12,7 @@
-export([sequence_minimum/1]).
-export([snowflake/1]).
-include_lib("bender_proto/include/bender_thrift.hrl").
-include_lib("bender_proto/include/bender_bender_thrift.hrl").
-type config() :: [{atom(), term()}].
-type group_name() :: atom().

View File

@ -31,7 +31,7 @@
{bender_proto, {git, "https://github.com/valitydev/bender-proto.git", {branch, "master"}}},
{erl_health, {git, "https://github.com/valitydev/erlang-health.git", {branch, "master"}}},
{genlib, {git, "https://github.com/valitydev/genlib.git", {branch, "master"}}},
{machinery, {git, "https://github.com/valitydev/machinery.git", {branch, "master"}}},
{machinery, {git, "https://github.com/valitydev/machinery-erlang.git", {branch, "master"}}},
{scoper, {git, "https://github.com/valitydev/scoper.git", {branch, "master"}}},
{snowflake, {git, "https://github.com/valitydev/snowflake.git", {branch, "master"}}},
{woody, {git, "https://github.com/valitydev/woody_erlang.git", {branch, "master"}}}

View File

@ -2,7 +2,7 @@
[{<<"accept">>,{pkg,<<"accept">>,<<"0.3.5">>},2},
{<<"bender_proto">>,
{git,"https://github.com/valitydev/bender-proto.git",
{ref,"38ce3ffde52fb2f52a8d042e67a3e2715adb7546"}},
{ref,"71c56878c1cf154cdfab9bbc563ddba25abe7259"}},
0},
{<<"cache">>,{pkg,<<"cache">>,<<"2.3.3">>},1},
{<<"certifi">>,{pkg,<<"certifi">>,<<"2.8.0">>},2},
@ -25,18 +25,18 @@
{<<"idna">>,{pkg,<<"idna">>,<<"6.1.1">>},2},
{<<"jsx">>,{pkg,<<"jsx">>,<<"3.1.0">>},1},
{<<"machinery">>,
{git,"https://github.com/valitydev/machinery.git",
{ref,"db7c94b9913451e9558afa19f2fe77bf48d391da"}},
{git,"https://github.com/valitydev/machinery-erlang.git",
{ref,"62c32434c80a462956ad9d50f9bce47836580d77"}},
0},
{<<"metrics">>,{pkg,<<"metrics">>,<<"1.0.1">>},2},
{<<"mg_proto">>,
{git,"https://github.com/rbkmoney/machinegun_proto.git",
{ref,"d814d6948d4ff13f6f41d12c6613f59c805750b2"}},
{git,"https://github.com/valitydev/machinegun-proto.git",
{ref,"a411c7d5d779389c70d2594eb4a28a916dce1721"}},
1},
{<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.2.0">>},2},
{<<"msgpack_proto">>,
{git,"https://github.com/valitydev/msgpack-proto.git",
{ref,"ec15d5e854ea60c58467373077d90c2faf6273d8"}},
{ref,"7e447496aa5df4a5f1ace7ef2e3c31248b2a3ed0"}},
1},
{<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.1">>},2},
{<<"prometheus">>,{pkg,<<"prometheus">>,<<"4.8.1">>},0},