Skip to content

Commit 310d1cd

Browse files
authored
Merge pull request #1857 from hyperledger/develop
Iroha v1.4-rc.2
2 parents 653c61f + 842491c commit 310d1cd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+957
-525
lines changed

.github/build-iroha1.src.yml

Lines changed: 24 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ jobs:
7070
## anyway please read .github/README.md
7171
check_workflow_yaml_coressponds_to_src_yaml:
7272
runs-on: ubuntu-20.04 #ubuntu-latest
73-
#container: ubuntu:latest ## This is required as barrier between AWS-hosted runners and GitHub-hosted runners - they have different set of software, so run in container
7473
name: Check if github workflows were properly made from sources
7574
steps:
7675
- &step_detect_commented_pr
@@ -232,14 +231,6 @@ jobs:
232231
matrix_dockerimage_release: ${{steps.matrixes.outputs.matrix_dockerimage_release}}
233232
matrix_dockerimage_debug: ${{steps.matrixes.outputs.matrix_dockerimage_debug}}
234233

235-
buildspec_ubuntu: ${{steps.matrixes.outputs.buildspec_ubuntu}}
236-
buildspec_ubuntu_debug: ${{steps.matrixes.outputs.buildspec_ubuntu_release}}
237-
buildspec_ubuntu_release: ${{steps.matrixes.outputs.buildspec_ubuntu_debug}}
238-
buildspec_macos: ${{steps.matrixes.outputs.buildspec_macos}}
239-
buildspec_windows: ${{steps.matrixes.outputs.buildspec_windows}}
240-
buildspec_dockerimage_release: ${{steps.matrixes.outputs.buildspec_dockerimage_release}}
241-
buildspec_dockerimage_debug: ${{steps.matrixes.outputs.buildspec_dockerimage_debug}}
242-
243234
## Build docker image named 'hyperledger/iroha-builder' with all stuff to compile iroha and its dependancies
244235
## The result docker image is pushed with tags :pr-NUMBER, :commit-HASH, :branch-name, :tag-name,
245236
## and conditional tags :edge for development branch, and :latest for git-tags.
@@ -318,18 +309,11 @@ jobs:
318309
type=ref,event=pr
319310
type=ref,event=tag
320311
type=schedule
321-
type=edge,branch=develop
322-
# type=semver,pattern={{version}}
323-
# type=semver,pattern={{major}}.{{minor}}
324-
# type=sha,prefix=commit-,format=short
325-
# type=sha,prefix=commit-,format=long
326312
## Docker image will be pushed with tags:
327313
## - hash of file Dockerfile.builder
328314
## - branchname, when branch is pushed
329315
## - pr-NUMBER, when pushed to PR
330316
## - git tag when tag is pushed
331-
## - semver like 1.2.3 and 1.2 when tag vX.X.X is pushed
332-
## - tag 'edge' when branch support/1.2.x is pushed
333317
## - schedule, see the docs
334318
- &step_docker_meta_ghcr
335319
<<: *step_docker_meta
@@ -380,29 +364,16 @@ jobs:
380364
name: Check if dockertaghash exists in remote registry
381365
id: dockertag_already
382366
run: |
383-
## FIXME page size is 100 and cannot be more, this needs to be extended in loop asking tags till the end
384-
exists=$( curl -fL https://hub.docker.com/v2/repositories/$DOCKERHUB_ORG/iroha-builder/tags |
385-
jq 'any( .results[]|.name == "${{env.dockertag}}" ; .)' )
386-
echo "::set-output name=exists::$exists"
387-
388-
if test $exists = true ;then
389-
tag=$dockertag
390-
else
391-
tag=edge
392-
fi
393-
container="$DOCKERHUB_ORG/iroha-builder:$tag"
394-
echo "::set-output name=container::$container"
395-
echo "::set-output name=container_tag::$tag"
367+
echo "::set-output name=container::$DOCKERHUB_ORG/iroha-builder:$dockertag"
396368
-
397-
if: ${{ steps.dockertag_already.outputs.container_tag != env.dockertag ||
398-
steps.dockertag_already.outputs.container == '' }}
399-
name: Possible ERROR, edited but not pushed
369+
name: Possible ERROR, Dockerfile edited but image cannot be pushed
370+
if: ${{ steps.docker_login.outcome != 'success' || steps.build_and_push.outcome != 'success' }}
400371
env:
401372
container: ${{steps.dockertag_already.outputs.container}}
402373
dockertag: ${{env.dockertag}}
403374
run: |
404375
cat <<END
405-
::error::Running on container '$container', YOUR CHANGES TO Dockerfile.builder WERE NOT APPLYED.
376+
::error::CHANGES TO Dockerfile.builder WERE NOT APPLYED.
406377
407378
It seems container with tag '$dockertag' was not pushed to registry and does not exist remotely.
408379
The most possible reason is GitHub secrets are inaccessable to PRs from public forks.
@@ -425,12 +396,9 @@ jobs:
425396
## WARN secret dropped from output!, output may not contain secret,
426397
## and secret cannot be used in job:container directly, and there is no github non-secret variables...
427398
## if dockertag is already pushed then use it. But let it be empty when tag does not exist remotely.
428-
dockertag: ${{steps.dockertag.outputs.dockertag}}
429-
_dockertag: :${{steps.dockertag.outputs.dockertag}}
399+
dockertag: ${{steps.dockertag.outputs.dockertag}}
400+
container: ${{steps.dockertag_already.outputs.container}}
430401
pushed: ${{ steps.docker_login.outcome == 'success' && steps.build_and_push.outcome == 'success' }}
431-
dockertag_already_exists: ${{steps.dockertag_already.outputs.exists}}
432-
container: ${{steps.dockertag_already.outputs.container}}
433-
container_tag: ${{steps.dockertag_already.outputs.container_tag}}
434402

435403
## Build iroha in a container made of the image earlier prepared
436404
## Result artifacts are
@@ -440,9 +408,8 @@ jobs:
440408
needs:
441409
- Docker-iroha-builder
442410
- generate_matrixes
443-
runs-on: [ self-hosted, Linux ] #ubuntu-latest
444-
## Container is taken from previous job
445-
container: #&container
411+
runs-on: [ self-hosted, Linux ]
412+
container: ## Container is taken from previous job
446413
image: &container_image ${{needs.Docker-iroha-builder.outputs.container}}
447414
options: --user root
448415
strategy: &strategy_ubuntu_debug
@@ -461,36 +428,9 @@ jobs:
461428
${{ toJson(needs) }}
462429
END
463430
-
464-
run: test -n "$container"
465-
env:
466-
container: *container_image
467-
-
468-
if: ${{ needs.Docker-iroha-builder.outputs.container_tag != needs.Docker-iroha-builder.outputs.dockertag ||
469-
needs.Docker-iroha-builder.outputs.container == '' }}
470-
name: Possible WARNING
471431
env:
472432
container: *container_image
473-
dockertag: ${{needs.Docker-iroha-builder.outputs.dockertag}}
474-
run: |
475-
cat <<END
476-
::warning::Running on container '$container', YOUR CHANGES TO Dockerfile.builder WERE NOT APPLYED.
477-
478-
It seems container with tag '$dockertag' was not pushed to registry and does not exist remotely.
479-
The most possible reason is GitHub secrets are inaccessable to PRs from public forks.
480-
481-
$(test ${{github.event.pull_request.head.repo.full_name}} != ${{github.event.pull_request.base.repo.full_name}} \
482-
&& echo -n "SECRETS ARE NOT EXPOSED TO FORKS" || echo -n "SECRETS AVAILABLE")
483-
484-
**Consider to open PR from the same organization.**
485-
486-
What we know about this build:
487-
- PR URL is ${{github.event.pull_request.html_url}}
488-
- head repo is '${{github.event.pull_request.head.repo.full_name}}'
489-
- base repo is '${{github.event.pull_request.base.repo.full_name}}'
490-
- See more information in previous step 'Show context'
491-
492-
Please ask @kuvaldini on GitHub or in Telegram if you need help.
493-
END
433+
run: test -n "$container"
494434
- *step_system_info
495435
- *step_build_info
496436
- &step_env_from_buildspec
@@ -541,7 +481,6 @@ jobs:
541481
- &step_store_ccache_stats
542482
run: ccache --show-stats | tee /tmp/ccache-stats
543483
- &step_vcpkg_cache
544-
#if: ${{false}} ## This works bad when something patched or something updated, seems they does not recalc hash of changed packages. See todos in the begining of file.
545484
## Read the docs https://vcpkg.readthedocs.io/en/latest/users/binarycaching/ https://github.com/microsoft/vcpkg/blob/master/docs/users/binarycaching.md
546485
name: Restore cache Vcpkg binarycache ## NOTE not useng NuGet because on ubuntu nuget needs mono of 433MB, unusable.
547486
uses: actions/cache@v2
@@ -810,7 +749,6 @@ jobs:
810749
- &step_brew_postgres
811750
name: Install Postgres on MacOS
812751
run: brew install postgresql
813-
## ToDo may be optimize, i.e. cache package
814752
- <<: *step_ctest
815753
timeout-minutes: 70
816754

@@ -832,10 +770,7 @@ jobs:
832770
strategy:
833771
fail-fast: false
834772
matrix: ${{ fromJSON( needs.generate_matrixes.outputs.matrix_windows ) }}
835-
#if: ${{ false }} ##FIXME Somehow cmake fails to find GTest and others
836773
if: ${{ false && ( fromJSON( needs.generate_matrixes.outputs.matrix_windows ).include[0] ) }}
837-
# matrix:
838-
# BuildYype: [ Debug ] #,Release, RelWithDebInfo
839774
defaults:
840775
run:
841776
shell: bash #pwsh
@@ -872,17 +807,16 @@ jobs:
872807
- *step_cmake_configure
873808
- *step_cmake_build
874809
- *step_always_after_build
875-
-
876-
name: Install Postgres on Windows
810+
- name: Install Postgres on Windows
877811
run: choco install postgresql
878812
# - *step_ctest
879813

880814
## Build and publish docker image named 'hyperledger/iroha' with irohad and iroha tools inside.
881-
## The result docker image is pushed with tags :pr-NUMBER, :commit-HASH, :branch-name, :tag-name,
882-
## and conditional tags :edge (for development branches) and :latest (for git-tags)
815+
## The result docker image is pushed with tags :branch_name, :pr-NUMBER, :tag_name,
816+
## and :latest (for git-tags).
883817
## Those docker image tags could be extended with suffixes with compiler and build type like
884-
## -gcc10, -clang, -debug, -gcc10-debug.
885-
## Result image name could look like: hyperledger/iroha:pr-1117, hyperledger/iroha-burrow:commit-XXXXX-debug
818+
## -gcc10, -clang, -debug, -gcc10-debug. Like :latest-debug, :main-debug, :1.3.0-gcc10-debug.
819+
## Result image name could look like: hyperledger/iroha:pr-1117, hyperledger/iroha:nightly.
886820
## Note: image is push only when DockerHub login-token pair available - not to PRs from forks
887821
docker-R: &job_docker_image_release
888822
needs:
@@ -906,26 +840,28 @@ jobs:
906840
- *step_detect_commented_pr
907841
- *step_checkout
908842
- *step_artifact_suffix
909-
- &step_download_artifact_iroha_deb
910-
name: Download artifact
843+
- name: Download artifact
911844
uses: actions/download-artifact@v2
912845
with:
913846
name: iroha-deb${{env.ARTIFACT_SUFFIX}}
914-
- &rename_artifact_deb
915-
name: Rename artifact debs
847+
- name: Rename artifact debs
916848
run: |
917849
mv *iroha_shepherd.deb docker/release/iroha_shepherd.deb
918850
mv *irohad.deb docker/release/iroha.deb
919-
- &step_dockertag_release
920-
<<: *step_docker_tag
851+
- <<: *step_docker_tag
921852
env:
922853
dockertag: ${{ hashFiles('docker/release/**') }}
923854
- <<: *step_docker_meta
924855
with: &step_docker_release_meta_with
925-
<<: *step_docker_meta_with
926856
images: |
927857
${{ env.DOCKERHUB_ORG }}/${{ env.IMAGE_NAME }}${{ env._uses_suffix }}
928-
flavor: suffix=${{env._compiler_suffix}}${{env._debug_suffix}}
858+
tags: |
859+
type=ref,event=branch
860+
type=ref,event=pr
861+
type=ref,event=tag
862+
type=schedule
863+
flavor: |
864+
suffix=${{env._compiler_suffix}}${{env._debug_suffix}},onlatest=true
929865
#maybetodo flavor: prefix=${{ env.USES_PREFIX }} ## In case creating repository hyperledger/iroha-burrow denied, Use tag prefix hyperledger/iroha:burrow-xxxx
930866
- <<: *step_docker_meta_ghcr
931867
with:

.github/chatops-gen-matrix.sh

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ handle_user_line(){
6868
return
6969
fi
7070
if [[ "${1:-}" != '/build' ]] ;then
71-
echowarn "Line skipped, should start with '/build'"
71+
echowarn "Line skipped, should start with '/build' : '${1:-}'"
7272
return
7373
fi
7474
shift
@@ -129,9 +129,9 @@ handle_user_line(){
129129
done
130130
done
131131
done
132-
if test "$used_compilers" = ''; then
133-
echowarn "No available compilers for '$os' among '$compilers', available: '$AVAILABLE_compilers'"
134-
fi
132+
# if test "$used_compilers" = ''; then
133+
# echowarn "No available compilers for '$os' among '$compilers', available: '$AVAILABLE_compilers'"
134+
# fi
135135
done
136136
}
137137

@@ -160,12 +160,6 @@ rm -f $ignored
160160

161161

162162
to_json(){
163-
# echo "{
164-
# os:\"$1\",
165-
# cc:\"$2\",
166-
# BuildType:\"$3\",
167-
# CMAKE_USE:\"$( [[ "$4" = normal ]] || echo "-DUSE_${4^^}=ON" )\"
168-
# }"
169163
echo "{buildspec:\"$@\"}"
170164
}
171165
to_json_multiline(){
@@ -185,16 +179,6 @@ json_include(){
185179
MATRIX="$(echo "$MATRIX" | sed '/^$/d' | sort -uV)"
186180
echo "$MATRIX"
187181

188-
echo "$MATRIX" >buildspec
189-
echo "$MATRIX" | awk -v IGNORECASE=1 '/ubuntu/' >buildspec_ubuntu
190-
echo "$MATRIX" | awk -v IGNORECASE=1 '/ubuntu/ && /release/' >buildspec_ubuntu_release
191-
echo "$MATRIX" | awk -v IGNORECASE=1 '/ubuntu/ && /debug/' >buildspec_ubuntu_debug
192-
echo "$MATRIX" | awk -v IGNORECASE=1 '/macos/' >buildspec_macos
193-
echo "$MATRIX" | awk -v IGNORECASE=1 '/windows/' >buildspec_windows
194-
## Build Docker images only with GCC-9 (mainstream compiler)
195-
echo "$MATRIX" | awk -v IGNORECASE=1 '/ubuntu/ && /release/ && /gcc-9/' >buildspec_dockerimage_release
196-
echo "$MATRIX" | awk -v IGNORECASE=1 '/ubuntu/ && /debug/ && /gcc-9/' >buildspec_dockerimage_debug
197-
198182
echo "$MATRIX" | json_include >matrix
199183
echo "$MATRIX" | awk -v IGNORECASE=1 '/ubuntu/' | json_include >matrix_ubuntu
200184
echo "$MATRIX" | awk -v IGNORECASE=1 '/ubuntu/ && /release/' | json_include >matrix_ubuntu_release

0 commit comments

Comments
 (0)