dapr 0.2.6 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a4ae91a840e9e8bd3f0690d7df96ca49ffc67bab2335d875f58742aa7559d26
4
- data.tar.gz: 05e4355dbc51c83e9e05a3eff5e835441d2c48d8f4727a23acf1ff73624a5b4d
3
+ metadata.gz: d001bf2fd07204b306fd2a246c0c4af09286c8f552191db799ee207d4daa272f
4
+ data.tar.gz: 63805e4f48f6557d8921d11d45cd1d5da08c42a6ce7feef63c3c3277cc175e62
5
5
  SHA512:
6
- metadata.gz: 32f912473a0eb40cf9790d2a5e5816f1a3c273695e5bffb2d014cb60506ab83f3f1eba8c0a81a4d280162559df5f2ff5fae258d19dd46881042cedc9b6e78229
7
- data.tar.gz: a0df7ede1af8f9700efd0a98ec3432dec5284a52e7011a92fbe90897954a52a1517be382b2a5b88ae16e0952795303bc29134e89ec9a89bf72b108299ca4e316
6
+ metadata.gz: 57727a5210314aa669ce8528007d25924424c2e6548209d83603262e364f8d73605c79d39cddc6c8ceb34ee3f1fca17e6666bef0035e7e89ebfab4c0b1901d30
7
+ data.tar.gz: a22ea07ef846e43d3ca53ed032579fdb8067809e8e451bea3fdefa709d0ed88d0d8820cf25db5cebaef6a8c9e324611f1e09cdead35c0ceb24a289b9b0458ccf
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "0.2.6"
2
+ ".": "0.2.8"
3
3
  }
data/.version.txt CHANGED
@@ -1 +1 @@
1
- 0.2.6
1
+ 0.2.8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.8](https://github.com/rubyists/dapr-ruby-client/compare/v0.2.7...v0.2.8) (2024-06-03)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * Adds type declaration to workflow inputs ([#50](https://github.com/rubyists/dapr-ruby-client/issues/50)) ([3203b1c](https://github.com/rubyists/dapr-ruby-client/commit/3203b1cfa383f58b61a7fc00f57bbd007c1ff494))
9
+ * **build:** Corrects name of image build script ([#49](https://github.com/rubyists/dapr-ruby-client/issues/49)) ([04ff29e](https://github.com/rubyists/dapr-ruby-client/commit/04ff29e5812ac5986f3ec01b10300c566d12979c))
10
+
11
+ ## [0.2.7](https://github.com/rubyists/dapr-ruby-client/compare/v0.2.6...v0.2.7) (2024-06-03)
12
+
13
+
14
+ ### Features
15
+
16
+ * **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))
17
+
3
18
  ## [0.2.6](https://github.com/rubyists/dapr-ruby-client/compare/v0.2.5...v0.2.6) (2024-06-03)
4
19
 
5
20
 
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.sh 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
+ mapfile -t tags < <(echo "$tag" | awk -F'.' 'NF==3{print $1"."$2"."$3; print $1"."$2; print $1; next} NF==2{print $1"."$2; print $1; next} {print}')
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
@@ -3,7 +3,7 @@
3
3
  module Rubyists
4
4
  module Dapr
5
5
  # x-release-please-start-version
6
- VERSION = '0.2.6'
6
+ VERSION = '0.2.8'
7
7
  # x-release-please-end
8
8
  end
9
9
  end
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/$RUBY_VERSION-alpine$ALPINE_VERSION
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.6
4
+ version: 0.2.8
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.sh
58
59
  - ci/publish-gem.sh
59
60
  - coverage/coverage.json
60
61
  - lib/dapr.rb