dapr 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.release-please-manifest.json +1 -1
- data/.version.txt +1 -1
- data/CHANGELOG.md +7 -0
- data/Readme.adoc +8 -0
- data/ci/build_image +248 -0
- data/lib/dapr/version.rb +1 -1
- data/oci/Containerfile +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9f4294d26869aed36aea295650b7f6ffcf15173812fbc76679dc361093a6a2d
|
4
|
+
data.tar.gz: c068d94e60edbe17b2120d7393af514a497474dd980b587da784fdb467a33bfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8055172e840a45c368f1444a38df0f417c25ab2b3763b04718572a018cb78df8943fc8c9f08f3d7197abaa863000a33615ec1d496e03f23b8a1391d7d71c664e
|
7
|
+
data.tar.gz: 8e4a426aa303f960c27903b42bf145b52e73398090de48736eb9503ced92f5dc08d9a980fad5fb021a323163feef46fedf360d7437f064956fd2c9d8c0eb6e3f
|
data/.version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.7
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.2.7](https://github.com/rubyists/dapr-ruby-client/compare/v0.2.6...v0.2.7) (2024-06-03)
|
4
|
+
|
5
|
+
|
6
|
+
### Features
|
7
|
+
|
8
|
+
* **lock:** Release distributed lock component ([#47](https://github.com/rubyists/dapr-ruby-client/issues/47)) ([706d6d5](https://github.com/rubyists/dapr-ruby-client/commit/706d6d58e93c70a25db56ae8bf94975e36963509))
|
9
|
+
|
3
10
|
## [0.2.6](https://github.com/rubyists/dapr-ruby-client/compare/v0.2.5...v0.2.6) (2024-06-03)
|
4
11
|
|
5
12
|
|
data/Readme.adoc
CHANGED
@@ -137,6 +137,14 @@ value = Rubyists::Dapr::Client::Configuration.get('TEST_KEY')
|
|
137
137
|
|
138
138
|
Implementation of {distributed-lock-block}
|
139
139
|
|
140
|
+
[source,ruby]
|
141
|
+
----
|
142
|
+
require 'dapr/client/lock'
|
143
|
+
lock = Rubyists::Dapr::Client::Lock.acquire('TEST_LOCK')
|
144
|
+
... do_important_stuff ...
|
145
|
+
lock.unlock!
|
146
|
+
----
|
147
|
+
|
140
148
|
=== Workflow
|
141
149
|
|
142
150
|
Implementation of {workflow-block}
|
data/ci/build_image
ADDED
@@ -0,0 +1,248 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
if readlink -f . >/dev/null 2>&1 # {{{ makes readlink work on mac
|
4
|
+
then
|
5
|
+
readlink=readlink
|
6
|
+
else
|
7
|
+
if greadlink -f . >/dev/null 2>&1
|
8
|
+
then
|
9
|
+
readlink=greadlink
|
10
|
+
else
|
11
|
+
printf "You must install greadlink to use this (brew install coreutils)\n" >&2
|
12
|
+
fi
|
13
|
+
fi # }}}
|
14
|
+
|
15
|
+
# Set here to the full path to this script
|
16
|
+
me=${BASH_SOURCE[0]}
|
17
|
+
[ -L "$me" ] && me=$($readlink -f "$me")
|
18
|
+
here=$(cd "$(dirname "$me")" && pwd)
|
19
|
+
just_me=$(basename "$me")
|
20
|
+
|
21
|
+
repo_top=$(git rev-parse --show-toplevel)
|
22
|
+
cd "$repo_top" || {
|
23
|
+
printf "Could not cd to %s\n" "$repo_top" >&2
|
24
|
+
exit 1
|
25
|
+
}
|
26
|
+
|
27
|
+
base_dir=$(basename "$(pwd)")
|
28
|
+
: "${IMAGE_NAME:=$base_dir}"
|
29
|
+
: "${BUILD_CONTEXT:=$(pwd)}"
|
30
|
+
: "${LICENSE:=MIT}"
|
31
|
+
: "${REGISTRY:=ghcr.io}"
|
32
|
+
|
33
|
+
usage() { # {{{
|
34
|
+
cat <<-EOT
|
35
|
+
Build an image, optionally pushing it to the registry
|
36
|
+
|
37
|
+
Usage: $0 <options> <image_tag>
|
38
|
+
Options:
|
39
|
+
-c CONTAINERFILE Path to the containerfile (default: ./oci/Containerfile)
|
40
|
+
-C CONTEXT Build context (default: $BUILD_CONTEXT)
|
41
|
+
-i NAME Name of the image (default: $IMAGE_NAME)
|
42
|
+
-l LICENSE License of the image (default: $LICENSE)
|
43
|
+
-r REGISTRY Registry to push the image to when -p is given (default: $REGISTRY)
|
44
|
+
-p Push the image to the registry
|
45
|
+
-h Show help / usage
|
46
|
+
EOT
|
47
|
+
} # }}}
|
48
|
+
|
49
|
+
die() { # {{{
|
50
|
+
local -i code
|
51
|
+
code=$1
|
52
|
+
shift
|
53
|
+
error "$*"
|
54
|
+
printf "\n" >&2
|
55
|
+
usage >&2
|
56
|
+
# shellcheck disable=SC2086
|
57
|
+
exit $code
|
58
|
+
} # }}}
|
59
|
+
|
60
|
+
## Logging functions # {{{
|
61
|
+
log() { # {{{
|
62
|
+
printf "%s [%s] <%s> %s\n" "$(date '+%Y-%m-%d %H:%M:%S.%6N')" "$$" "${just_me:-$0}" "$*"
|
63
|
+
} # }}}
|
64
|
+
|
65
|
+
debug() { # {{{
|
66
|
+
[ $verbose -lt 2 ] && return 0
|
67
|
+
# shellcheck disable=SC2059
|
68
|
+
log_line=$(printf "$@")
|
69
|
+
log "[DEBUG] $log_line" >&2
|
70
|
+
} # }}}
|
71
|
+
|
72
|
+
warn() { # {{{
|
73
|
+
# shellcheck disable=SC2059
|
74
|
+
log_line=$(printf "$@")
|
75
|
+
log "[WARN] $log_line" >&2
|
76
|
+
} # }}}
|
77
|
+
|
78
|
+
error() { # {{{
|
79
|
+
# shellcheck disable=SC2059
|
80
|
+
log_line=$(printf "$@")
|
81
|
+
log "[ERROR] $log_line" >&2
|
82
|
+
} # }}}
|
83
|
+
|
84
|
+
info() { # {{{
|
85
|
+
[ $verbose -lt 1 ] && return 0
|
86
|
+
# shellcheck disable=SC2059
|
87
|
+
log_line=$(printf "$@")
|
88
|
+
log "[INFO] $log_line" >&2
|
89
|
+
} # }}}
|
90
|
+
# }}}
|
91
|
+
|
92
|
+
push=0
|
93
|
+
verbose=0
|
94
|
+
while getopts :hpvc:C:i:l:r: opt # {{{
|
95
|
+
do
|
96
|
+
case $opt in
|
97
|
+
c)
|
98
|
+
CONTAINERFILE=$OPTARG
|
99
|
+
;;
|
100
|
+
C)
|
101
|
+
BUILD_CONTEXT=$OPTARG
|
102
|
+
;;
|
103
|
+
i)
|
104
|
+
IMAGE_NAME=$OPTARG
|
105
|
+
;;
|
106
|
+
l)
|
107
|
+
LICENSE=$OPTARG
|
108
|
+
;;
|
109
|
+
r)
|
110
|
+
REGISTRY=$OPTARG
|
111
|
+
;;
|
112
|
+
p)
|
113
|
+
push=1
|
114
|
+
;;
|
115
|
+
v)
|
116
|
+
verbose=$((verbose + 1))
|
117
|
+
;;
|
118
|
+
h)
|
119
|
+
usage
|
120
|
+
exit
|
121
|
+
;;
|
122
|
+
:)
|
123
|
+
printf "Option %s requires an argument\n" "$OPTARG" >&2
|
124
|
+
usage >&2
|
125
|
+
exit 28
|
126
|
+
;;
|
127
|
+
?)
|
128
|
+
printf "Invalid option '%s'\n" "$OPTARG" >&2
|
129
|
+
usage >&2
|
130
|
+
exit 27
|
131
|
+
;;
|
132
|
+
esac
|
133
|
+
done # }}}
|
134
|
+
shift $((OPTIND-1))
|
135
|
+
|
136
|
+
tag=$1
|
137
|
+
[ -z "$tag" ] && die 1 "Missing image tag"
|
138
|
+
shift
|
139
|
+
|
140
|
+
# Check for extra argument
|
141
|
+
if [ $# -gt 0 ]; then
|
142
|
+
# If we have the special argument '--' we shift it away, otherwise we die
|
143
|
+
[ "$1" != '--' ] && die 2 "Too many arguments"
|
144
|
+
# Once this is shifted away, the rest of the arguments are passed to the build command, below
|
145
|
+
shift
|
146
|
+
fi
|
147
|
+
|
148
|
+
|
149
|
+
if [ -z "$CONTAINERFILE" ]; then
|
150
|
+
printf "No containerfile specified, looking for default locations\n"
|
151
|
+
for containerfile in Containerfile Dockerfile
|
152
|
+
do
|
153
|
+
if [ -f ./oci/"$containerfile" ]; then
|
154
|
+
debug "Found ./oci/%s\n" "$containerfile"
|
155
|
+
containerfile=./oci/"$containerfile"
|
156
|
+
break
|
157
|
+
fi
|
158
|
+
if [ -f "$containerfile" ]; then
|
159
|
+
debug "Found %s\n" "$containerfile"
|
160
|
+
break
|
161
|
+
fi
|
162
|
+
done
|
163
|
+
else
|
164
|
+
[ -f "$CONTAINERFILE" ] || die 3 "Containerfile '$CONTAINERFILE' not found"
|
165
|
+
debug "Using containerfile %s\n" "$CONTAINERFILE"
|
166
|
+
containerfile=$CONTAINERFILE
|
167
|
+
fi
|
168
|
+
|
169
|
+
[ -f "$containerfile" ] || die 4 "No containerfile found"
|
170
|
+
|
171
|
+
[ -d "$BUILD_CONTEXT" ] || die 5 "Build context '$BUILD_CONTEXT' not found"
|
172
|
+
|
173
|
+
debug 'Building image from %s in in %s\n' "$containerfile" "$here"
|
174
|
+
# Build the image
|
175
|
+
if command -v podman 2>/dev/null
|
176
|
+
then
|
177
|
+
runtime=podman
|
178
|
+
elif command -v docker 2>/dev/null
|
179
|
+
then
|
180
|
+
runtime=docker
|
181
|
+
else
|
182
|
+
die 6 "No container runtime found"
|
183
|
+
fi
|
184
|
+
|
185
|
+
revision=$(git rev-parse HEAD)
|
186
|
+
shortref=$(git rev-parse --short "$revision")
|
187
|
+
repo_url=$(git remote get-url origin)
|
188
|
+
if [ -z "$repo_url" ]
|
189
|
+
then
|
190
|
+
die 7 "No remote found"
|
191
|
+
fi
|
192
|
+
if [[ $repo_url == *github.com/* ]]
|
193
|
+
then
|
194
|
+
owner_and_repo=${repo_url#*github.com/}
|
195
|
+
else
|
196
|
+
owner_and_repo=${repo_url##*:}
|
197
|
+
fi
|
198
|
+
# Get rid of the trailing .git
|
199
|
+
service=$(basename "$owner_and_repo" .git)
|
200
|
+
owner=$(dirname "$owner_and_repo")
|
201
|
+
|
202
|
+
# Pass any extra arguments to the build command ("$@" contains the rest of the arguments)
|
203
|
+
$runtime build --tag "$IMAGE_NAME:$tag" "$@" \
|
204
|
+
--label org.opencontainers.image.created="$(date --utc --iso-8601=seconds)" \
|
205
|
+
--label org.opencontainers.image.description="Image for $service" \
|
206
|
+
--label org.opencontainers.image.licenses="$LICENSE" \
|
207
|
+
--label org.opencontainers.image.revision="$revision" \
|
208
|
+
--label org.opencontainers.image.url="$repo_url" \
|
209
|
+
--label org.opencontainers.image.title="$IMAGE_NAME" \
|
210
|
+
--label org.opencontainers.image.source="Generated by gitops_tools/bin/build_image ($USER@$HOSTNAME)" \
|
211
|
+
--label org.opencontainers.image.version="$tag" \
|
212
|
+
--label shortref="$shortref" \
|
213
|
+
-f "$containerfile" "$BUILD_CONTEXT" || die 8 "Failed to build image"
|
214
|
+
|
215
|
+
[ $push -eq 1 ] || exit 0
|
216
|
+
if ! $runtime login --get-login "$REGISTRY" >/dev/null 2>/dev/null
|
217
|
+
then
|
218
|
+
printf "Not logged in to '%s', trying to login\n" "$REGISTRY" >&2
|
219
|
+
[ -z "$GITHUB_TOKEN" ] && die 9 "No GITHUB_TOKEN set, cannot login"
|
220
|
+
printf "%s" "$GITHUB_TOKEN" | $runtime login -u "$GITHUB_TOKEN" --password-stdin "$REGISTRY" || die 10 "Failed to login to $REGISTRY"
|
221
|
+
fi
|
222
|
+
|
223
|
+
tags=($(echo "$tag" | awk -F'.' 'NF==3{print $1"."$2"."$3" "$1"."$2" "$1} NF==2{print $1"."$2" "$1} NF==1{print $1}'))
|
224
|
+
for t in "${tags[@]}"
|
225
|
+
do
|
226
|
+
proper_tag=$IMAGE_NAME:$tag
|
227
|
+
new_tag=$IMAGE_NAME:$t
|
228
|
+
debug "Tagging %s as %s\n" "$proper_tag" "$new_tag"
|
229
|
+
if [ "$runtime" = "podman" ]
|
230
|
+
then
|
231
|
+
if [ "$proper_tag" != "$new_tag" ]
|
232
|
+
then
|
233
|
+
podman tag "$proper_tag" "$new_tag" || die 11 "Failed to tag image $proper_tag as $new_tag"
|
234
|
+
fi
|
235
|
+
registry_image_name="$REGISTRY/$owner/$new_tag"
|
236
|
+
podman push "$new_tag" "$registry_image_name" || die 12 "Failed to push image $new_tag to $registry_image_name"
|
237
|
+
else
|
238
|
+
registry_image_name="$REGISTRY/$owner/$new_tag"
|
239
|
+
proper_registry_name="$REGISTRY/$owner/$proper_tag"
|
240
|
+
if [ "$proper_tag" != "$new_tag" ]
|
241
|
+
then
|
242
|
+
docker tag "$proper_registry_name" "$registry_image_name" || die 13 "Failed to tag image $proper_tag as $new_tag"
|
243
|
+
fi
|
244
|
+
docker push "$registry_image_name" || die 14 "Failed to push image $new_tag to $registry_image_name"
|
245
|
+
fi
|
246
|
+
done
|
247
|
+
|
248
|
+
# vim: set foldmethod=marker et ts=4 sts=4 sw=4 ft=bash :
|
data/lib/dapr/version.rb
CHANGED
data/oci/Containerfile
CHANGED
@@ -35,7 +35,7 @@ RUN rm -rf node_modules tmp/cache app/assets vendor/assets spec
|
|
35
35
|
############### Build step done ###############
|
36
36
|
ARG ALPINE_VERSION=3.19
|
37
37
|
ARG RUBY_VERSION=3.3.1
|
38
|
-
FROM docker.io
|
38
|
+
FROM docker.io/ruby:$RUBY_VERSION-alpine$ALPINE_VERSION
|
39
39
|
|
40
40
|
ARG APP_ROOT=/app
|
41
41
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dapr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tj (bougyman) Vanderpoel
|
@@ -55,6 +55,7 @@ files:
|
|
55
55
|
- CHANGELOG.md
|
56
56
|
- Rakefile
|
57
57
|
- Readme.adoc
|
58
|
+
- ci/build_image
|
58
59
|
- ci/publish-gem.sh
|
59
60
|
- coverage/coverage.json
|
60
61
|
- lib/dapr.rb
|