Skip to content

Commit 901ad8f

Browse files
committed
[CI] Updates automation tasks
- We're not using assemble anymore, so updated it to build_gems - Removed other outdated code
1 parent a72e926 commit 901ad8f

File tree

3 files changed

+12
-56
lines changed

3 files changed

+12
-56
lines changed

.github/make.sh

+3-30
Original file line numberDiff line numberDiff line change
@@ -34,34 +34,23 @@ STACK_VERSION=$VERSION
3434
set -euo pipefail
3535

3636
product="elastic/elasticsearch-ruby"
37-
output_folder=".ci/output"
38-
codegen_folder=".ci/output"
39-
OUTPUT_DIR="$repo/${output_folder}"
40-
REPO_BINDING="${OUTPUT_DIR}:/sln/${output_folder}"
4137
RUBY_VERSION=${RUBY_VERSION-3.1}
4238
WORKFLOW=${WORKFLOW-staging}
43-
mkdir -p "$OUTPUT_DIR"
4439

4540
echo -e "\033[34;1mINFO:\033[0m PRODUCT ${product}\033[0m"
4641
echo -e "\033[34;1mINFO:\033[0m VERSION ${STACK_VERSION}\033[0m"
47-
echo -e "\033[34;1mINFO:\033[0m OUTPUT_DIR ${OUTPUT_DIR}\033[0m"
4842
echo -e "\033[34;1mINFO:\033[0m RUBY_VERSION ${RUBY_VERSION}\033[0m"
4943

5044
case $CMD in
5145
clean)
5246
echo -e "\033[36;1mTARGET: clean workspace $output_folder\033[0m"
53-
rm -rf "$output_folder"
47+
rm -rf "/build"
5448
echo -e "\033[32;1mdone.\033[0m"
5549
exit 0
5650
;;
5751
assemble)
58-
if [ -v $VERSION ]; then
59-
echo -e "\033[31;1mTARGET: assemble -> missing version parameter\033[0m"
60-
exit 1
61-
fi
62-
echo -e "\033[36;1mTARGET: assemble artefact $VERSION\033[0m"
63-
TASK=assemble
64-
TASK_ARGS=("$VERSION" "$output_folder")
52+
echo -e "\033[36;1mTARGET: assemble\033[0m"
53+
TASK=build_gems
6554
;;
6655
codegen)
6756
TASK=codegen
@@ -74,13 +63,10 @@ case $CMD in
7463
fi
7564
echo -e "\033[36;1mTARGET: generate docs for $VERSION\033[0m"
7665
TASK=codegen
77-
# VERSION is BRANCH here for now
78-
TASK_ARGS=("$VERSION" "$codegen_folder")
7966
;;
8067
examplesgen)
8168
echo -e "\033[36;1mTARGET: generate docs examples\033[0m"
8269
TASK='docs:generate'
83-
# VERSION is BRANCH here for now
8470
TASK_ARGS=()
8571
;;
8672
bump)
@@ -134,8 +120,6 @@ docker build --no-cache --build-arg BUILDER_UID="$(id -u)" --file .buildkite/Doc
134120

135121
echo -e "\033[34;1mINFO: running $product container\033[0m"
136122

137-
mkdir -p "$OUTPUT_DIR"
138-
139123
# Convert ARGS to comma separated string for Rake:
140124
args_string="${TASK_ARGS[*]}"
141125
args_string="${args_string// /,}"
@@ -145,7 +129,6 @@ docker run \
145129
--env "RUBY_VERSION=${RUBY_VERSION}" \
146130
--env "WORKFLOW=${WORKFLOW}" \
147131
--name test-runner \
148-
--volume "${REPO_BINDING}" \
149132
--volume "${repo}:/usr/src/app" \
150133
--rm \
151134
"${product}" \
@@ -154,16 +137,6 @@ docker run \
154137
# ------------------------------------------------------- #
155138
# Post Command tasks & checks
156139
# ------------------------------------------------------- #
157-
158-
if [[ "$CMD" == "assemble" ]]; then
159-
if compgen -G ".ci/output" > /dev/null; then
160-
echo -e "\033[32;1mTARGET: successfully assembled client v$VERSION\033[0m"
161-
else
162-
echo -e "\033[31;1mTARGET: assemble failed, empty workspace!\033[0m"
163-
exit 1
164-
fi
165-
fi
166-
167140
if [[ "$CMD" == "docsgen" ]]; then
168141
echo "TODO"
169142
fi

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ Gemfile.lock
1414
profile/**/data/*.json
1515
.ci/output
1616
parsed_alternative_report.json
17-
.byebug_history
17+
.byebug_history
18+
build/
19+
*.gem

rake_tasks/unified_release_tasks.rake

+6-25
Original file line numberDiff line numberDiff line change
@@ -20,43 +20,24 @@ require_relative '../elasticsearch/lib/elasticsearch/version'
2020

2121
namespace :unified_release do
2222
desc 'Build gem releases and snapshots'
23-
task :assemble, [:version, :output_dir] do |_, args|
24-
if ENV['WORKFLOW'] == 'snapshot'
25-
@zip_filename = "elasticsearch-ruby-#{args[:version]}-SNAPSHOT"
26-
@version = "#{args[:version]}.#{Time.now.strftime('%Y%m%d%H%M%S')}-SNAPSHOT"
27-
else
28-
@version = args[:version]
29-
@zip_filename = "elasticsearch-ruby-#{@version}"
30-
end
31-
32-
Rake::Task['unified_release:bump'].invoke(@version) unless @version == Elasticsearch::VERSION
33-
34-
build_gems(args[:output_dir])
35-
create_zip_file(args[:output_dir])
36-
end
23+
task :build_gems do |_, args|
24+
output_dir = File.expand_path(__dir__ + '/../build')
25+
require 'byebug'; byebug
3726

38-
def build_gems(output_dir)
39-
raise ArgumentError, 'You must specify an output dir' unless output_dir
4027

41-
# Create dir if it doesn't exist
4228
dir = CURRENT_PATH.join(output_dir).to_s
4329
FileUtils.mkdir_p(dir) unless File.exist?(dir)
44-
30+
version = Elasticsearch::VERSION
4531
RELEASE_TOGETHER.each do |gem|
4632
puts '-' * 80
47-
puts "Building #{gem} v#{@version} to #{output_dir}"
33+
puts "Building #{gem} v#{version} to #{output_dir}"
4834
sh "cd #{CURRENT_PATH.join(gem)} " \
49-
"&& gem build --silent -o #{gem}-#{@version}.gem && " \
35+
"&& gem build --silent -o #{gem}-#{version}.gem && " \
5036
"mv *.gem #{CURRENT_PATH.join(output_dir)}"
5137
end
5238
puts '-' * 80
5339
end
5440

55-
def create_zip_file(output_dir)
56-
sh "cd #{CURRENT_PATH.join(output_dir)} && " \
57-
"zip -r #{@zip_filename}.zip * " \
58-
end
59-
6041
desc 'Generate API code'
6142
task :codegen do
6243
version = YAML.load_file(File.expand_path(__dir__ + '/../.buildkite/pipeline.yml'))['steps'].first['env']['STACK_VERSION']

0 commit comments

Comments
 (0)