-
Notifications
You must be signed in to change notification settings - Fork 5
603 lines (519 loc) · 23.2 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
name: CI
on: [push]
env:
DOCKER_REGIRSTY_HOST: ghcr.io
DOCKER_REGISTRY: ghcr.io/lmco/chaordicledger
CUSTOM_BUILDER_IMAGE_NAME: customgradlebuilder
CUSTOM_BUILDER_IMAGE_VERSION: 0.0.1
GENERATED_CODE_DIR: generated
# Intentionally using the version 2 generator here; while the online editor will generate Upload options correctly for multipart/form-data,
# neither the downloadable generated nodejs server code nor the codegen-cli handle it properly, instead creating a JSON input.
# Version 2.4.27 however appears to work.
SWAGGER_CODEGEN_CLI_SOURCE_JAR: https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.27/swagger-codegen-cli-2.4.27.jar
#SWAGGER_CODEGEN_CLI_SOURCE_JAR: https://repo1.maven.org/maven2/io/swagger/codegen/v3/swagger-codegen-cli/3.0.34/swagger-codegen-cli-3.0.34.jar
SWAGGER_CODEGEN_CLI_LOCAL_JAR: swagger-codegen-cli.jar
SWAGGER_API_FILE: api/swagger.json
OUT_GO: out/go
OUT_JAVA: out/java
OUT_NODEJS: out/nodejs
jobs:
generate-api-code:
# Reference: https://github.com/swagger-api/swagger-codegen/blob/master/standalone-gen-dev/standalone-generator-development.md
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v2
- name: API Generation Setup
run: |
wget ${{ env.SWAGGER_CODEGEN_CLI_SOURCE_JAR }} -O ${{ env.SWAGGER_CODEGEN_CLI_LOCAL_JAR }}
- name: API Generation - GO
run: |
mkdir -p ${{ env.OUT_GO }}
java -jar ${{ env.SWAGGER_CODEGEN_CLI_LOCAL_JAR }} generate -i ${{ env.SWAGGER_API_FILE }} -l go -o ${{ env.OUT_GO }}
- name: Archive generated GO code
uses: actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3
with:
name: go-api
path: ${{ env.OUT_GO }}
- name: API Generation - Java
run: |
mkdir -p ${OUT_JAVA}
java -jar ${{ env.SWAGGER_CODEGEN_CLI_LOCAL_JAR }} generate -i ${{ env.SWAGGER_API_FILE }} -l java -o ${{ env.OUT_JAVA }}
# As of 2022-Mar-31, jcenter no longer exists.
sed -i "s|jcenter|mavenCentral|g" ${{ env.OUT_JAVA }}/build.gradle
# In Gradle 7.x: The maven plugin has been removed; need to use the maven-publish plugin instead.
#sed -i "s|apply plugin: 'maven'|apply plugin: 'maven-publish'|g" ${{ env.OUT_JAVA }}/build.gradle
# # May need to override the generated manifest file to specify the internal classpath and specify the main class.
# ls -rotl ${OUT_JAVA}/build/tmp/jar
# cat ${OUT_JAVA}/build/tmp/jar/MANIFEST.MF
mainClassName=ArtifactsApiExample
ls -rotl
ls -rotl api/
cp api/${mainClassName}.java ${OUT_JAVA}/src/main/java/
# Update the pom file to include the manifest
cp ${OUT_JAVA}/pom.xml ${OUT_JAVA}/pom.xml.orig
cat ${OUT_JAVA}/pom.xml.orig | tr '\n' '|' | sed "s|\(<artifactId>maven-jar-plugin</artifactId>.*<executions>.*<configuration>\).*\(</configuration>[^<]*</plugin>\)|\1\|<archive><manifest><mainClass>${mainClassName}</mainClass></manifest></archive>\|\2|" | tr '|' '\n' > ${OUT_JAVA}/pom.xml
cat ${OUT_JAVA}/pom.xml
ls -rotl ${OUT_JAVA}
- name: Archive generated JAVA code
uses: actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3
with:
name: java-api
path: ${{ env.OUT_JAVA }}
- name: API Server Generation - NodeJS
run: |
mkdir -p ${{ env.OUT_NODEJS }}
java -jar ${{ env.SWAGGER_CODEGEN_CLI_LOCAL_JAR }} generate -i ${{ env.SWAGGER_API_FILE }} -l nodejs-server -o ${{ env.OUT_NODEJS }}
- name: API Server Implementation - NodeJS
uses: actions/setup-python@e9aba2c848f5ebd159c070c61ea2c4e2b122355e # v2
with:
python-version: 3.8 #install the python needed
- name: Overlay NodeJS Server Implementation
run: |
# Need to overlay the functional implementation to the generated code.
# Probably easiest to do this with python...
ArtifactsServiceInputDir="./api/server/nodejs/functionScripts/ArtifactsService"
ls -rotl $ArtifactsServiceInputDir
ArtifactsServiceFunctionMapFile="$ArtifactsServiceInputDir/functionMap.json"
python ./api/server/nodejs/overlayServerImplementation.py -i $ArtifactsServiceInputDir -m $ArtifactsServiceFunctionMapFile -o ${{ env.OUT_NODEJS }}/service -f ArtifactsService.js
BlockchainServiceInputDir="./api/server/nodejs/functionScripts/BlockchainService"
ls -rotl $BlockchainServiceInputDir
BlockchainServiceFunctionMapFile="$BlockchainServiceInputDir/functionMap.json"
python ./api/server/nodejs/overlayServerImplementation.py -i $BlockchainServiceInputDir -m $BlockchainServiceFunctionMapFile -o ${{ env.OUT_NODEJS }}/service -f BlockchainService.js
MetadataServiceInputDir="./api/server/nodejs/functionScripts/MetadataService"
ls -rotl $MetadataServiceInputDir
MetadataServiceFunctionMapFile="$MetadataServiceInputDir/functionMap.json"
python ./api/server/nodejs/overlayServerImplementation.py -i $MetadataServiceInputDir -m $MetadataServiceFunctionMapFile -o ${{ env.OUT_NODEJS }}/service -f MetadataService.js
RelationshipsServiceInputDir="./api/server/nodejs/functionScripts/RelationshipsService"
ls -rotl $RelationshipsServiceInputDir
RelationshipsServiceFunctionMapFile="$RelationshipsServiceInputDir/functionMap.json"
python ./api/server/nodejs/overlayServerImplementation.py -i $RelationshipsServiceInputDir -m $RelationshipsServiceFunctionMapFile -o ${{ env.OUT_NODEJS }}/service -f RelationshipsService.js
SystemTestServiceInputDir="./api/server/nodejs/functionScripts/SystemTestService"
ls -rotl $SystemTestServiceInputDir
SystemTestServiceFunctionMapFile="$SystemTestServiceInputDir/functionMap.json"
python ./api/server/nodejs/overlayServerImplementation.py -i $SystemTestServiceInputDir -m $SystemTestServiceFunctionMapFile -o ${{ env.OUT_NODEJS }}/service -f SystemTestService.js
- name: Add API processing extension methods
run: |
cat ./api/server/nodejs/writerFunctions.js >> ${{ env.OUT_NODEJS }}/utils/writer.js
cat ./api/server/nodejs/customArtifactControllerFunctions.js >> ${{ env.OUT_NODEJS }}/controllers/Artifacts.js
#cat ./api/server/nodejs/customRelationshipControllerFunctions.js >> ${{ env.OUT_NODEJS }}/controllers/Relationships.js
cp ./tools/digraphReducer.py ${{ env.OUT_NODEJS }}/utils/
# - name: Generate NPM package details
# run: |
- name: Archive generated NodeJS code
uses: actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3
with:
name: nodejs-server
path: ${{ env.OUT_NODEJS }}
docker-API-Builder:
runs-on: ubuntu-latest
env:
# TAG: ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_VERSION }}
BUILD_DIR: api/builder
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v2
- name: Build image
run: |
imageTag=${{ env.DOCKER_REGISTRY }}/${{ env.CUSTOM_BUILDER_IMAGE_NAME }}:${{ env.CUSTOM_BUILDER_IMAGE_VERSION }}
docker build --tag $imageTag ${{ env.BUILD_DIR }} --no-cache
echo "imageTag=${imageTag}" >> $GITHUB_ENV
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${{ env.DOCKER_REGIRSTY_HOST }} -u ${{ github.actor }} --password-stdin
- name: Push image
run: |
docker push ${{ env.imageTag }}
build-java-api:
runs-on: ubuntu-latest
needs: [generate-api-code, docker-API-Builder]
steps:
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3
- name: List java-api Directory Contents
run: ls -rotl java-api
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${{ env.DOCKER_REGIRSTY_HOST }} -u ${{ github.actor }} --password-stdin
- name: Build Java API
run: |
cd java-api
docker run --rm -u root -v "$PWD":/home/gradle/project -w /home/gradle/project ${{ env.DOCKER_REGISTRY }}/${{ env.CUSTOM_BUILDER_IMAGE_NAME }}:${{ env.CUSTOM_BUILDER_IMAGE_VERSION }} gradle build test --no-daemon
ls -rotl
echo "buildRoot=${PWD}" >> $GITHUB_ENV
- name: Publish Java client jar
uses: actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3
with:
name: java-client
path: ${{ env.buildRoot }}/build/libs/*.jar
- name: Package Java API
run: |
cd java-api
docker run --rm -u root --name my-maven-project -v "$PWD":/usr/src/mymaven -w /usr/src/mymaven maven:3.3-jdk-8 mvn clean package
ls -rotl
ls -rotl build/tmp/jar
echo $PWD
ls -rotl ${PWD}/target
echo "targetRoot=${PWD}/target" >> $GITHUB_ENV
- name: Publish packaged Java client jar
uses: actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3
with:
name: java-client-package
path: |
${{ env.targetRoot }}/*.jar
${{ env.targetRoot }}/lib/*.jar
docker-API-UI:
runs-on: ubuntu-latest
env:
IMAGE_NAME: swagger-ui
IMAGE_VERSION: 0.0.1
BUILD_DIR: api/ui
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v2
- name: Copy API Definition
run: cp ${{ env.SWAGGER_API_FILE }} ${{ env.BUILD_DIR }}
- name: Build image
run: |
imageTag=${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_VERSION }}
docker build --tag $imageTag ${{ env.BUILD_DIR }}
echo "imageTag=${imageTag}" >> $GITHUB_ENV
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${{ env.DOCKER_REGIRSTY_HOST }} -u ${{ github.actor }} --password-stdin
- name: Push image
run: |
docker push ${{ env.imageTag }}
docker-casestudy-storefront:
runs-on: ubuntu-latest
env:
IMAGE_NAME: storefront
IMAGE_VERSION: 0.0.1
BUILD_DIR: case_study/storefrontApp/app
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v2
- name: Build image
run: |
imageTag=${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_VERSION }}
docker build --tag $imageTag ${{ env.BUILD_DIR }}
echo "imageTag=${imageTag}" >> $GITHUB_ENV
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${{ env.DOCKER_REGIRSTY_HOST }} -u ${{ github.actor }} --password-stdin
- name: Push image
run: |
docker push ${{ env.imageTag }}
docker-graphjob:
runs-on: ubuntu-latest
env:
IMAGE_NAME: graphjob
IMAGE_VERSION: 0.0.1
BUILD_DIR: graph
DOCKERFILE: JobDockerfile
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v2
- name: Build image
run: |
imageTag=${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_VERSION }}
docker build --tag $imageTag ${{ env.BUILD_DIR }} -f ${{ env.BUILD_DIR }}/${{ env.DOCKERFILE }}
echo "imageTag=${imageTag}" >> $GITHUB_ENV
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${{ env.DOCKER_REGIRSTY_HOST }} -u ${{ github.actor }} --password-stdin
- name: Push image
run: |
docker push ${{ env.imageTag }}
docker-graphprocessor:
runs-on: ubuntu-latest
env:
IMAGE_NAME: graphprocessor
IMAGE_VERSION: 0.0.1
BUILD_DIR: graph
DOCKERFILE: ProcessorDockerfile
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v2
- name: Build image
run: |
imageTag=${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_VERSION }}
docker build --tag $imageTag ${{ env.BUILD_DIR }} -f ${{ env.BUILD_DIR }}/${{ env.DOCKERFILE }}
echo "imageTag=${imageTag}" >> $GITHUB_ENV
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${{ env.DOCKER_REGIRSTY_HOST }} -u ${{ github.actor }} --password-stdin
- name: Push image
run: |
docker push ${{ env.imageTag }}
# docker-metadata-chaincode:
# uses: lmco/ChaordicLedger/.github/workflows/build-and-push-docker.yml@api_hookup
# secrets:
# registry: ${{ env.DOCKER_REGISTRY }}
# registry_host: ${{ env.DOCKER_REGIRSTY_HOST }}
# image_name: ${{ env.IMAGE_NAME }}
# image_version: ${{ env.IMAGE_VERSION }}
# secrets:
# user: ${{ github.actor }}
# token: ${{ secrets.GITHUB_TOKEN }}
docker-content-chaincode:
runs-on: ubuntu-latest
env:
IMAGE_NAME: content-chaincode
IMAGE_VERSION: v0.0.0
BUILD_DIR: chaincode/artifact-content/docker/
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v2
- name: Build image
run: |
imageTag=${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_VERSION }}
docker build --tag $imageTag ${{ env.BUILD_DIR }}
echo "imageTag=${imageTag}" >> $GITHUB_ENV
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${{ env.DOCKER_REGIRSTY_HOST }} -u ${{ github.actor }} --password-stdin
- name: Push image
run: |
docker push ${{ env.imageTag }}
docker-relationship-chaincode:
runs-on: ubuntu-latest
env:
IMAGE_NAME: relationship-chaincode
IMAGE_VERSION: v0.0.0
BUILD_DIR: chaincode/artifact-relationship/docker/
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v2
- name: Build image
run: |
imageTag=${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_VERSION }}
docker build --tag $imageTag ${{ env.BUILD_DIR }}
echo "imageTag=${imageTag}" >> $GITHUB_ENV
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${{ env.DOCKER_REGIRSTY_HOST }} -u ${{ github.actor }} --password-stdin
- name: Push image
run: |
docker push ${{ env.imageTag }}
docker-metadata-chaincode:
runs-on: ubuntu-latest
env:
IMAGE_NAME: metadata-chaincode
IMAGE_VERSION: v0.0.0
BUILD_DIR: chaincode/artifact-metadata/docker/
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v2
- name: Build image
run: |
imageTag=${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_VERSION }}
docker build --tag $imageTag ${{ env.BUILD_DIR }}
echo "imageTag=${imageTag}" >> $GITHUB_ENV
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${{ env.DOCKER_REGIRSTY_HOST }} -u ${{ github.actor }} --password-stdin
- name: Push image
run: |
docker push ${{ env.imageTag }}
build-obsidian-lightswitch-chaincode:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v2
- name: Checkout the Obsidian repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v2
with:
repository: mcoblenz/Obsidian
path: './Obsidian'
- name: Modify Obsidian build contents
run: |
pushd ./Obsidian
# Upgrade protocol buffer
sed -i 's|"protobuf-java" % "3\.11\.4"|"protobuf-java" % "3\.19\.1"|g' build.sbt
sed -i "s|'protobuf-java', version: '3.11.4'|'protobuf-java', version: '3.19.1'|g" fabric/java/build.gradle
# Upgrade chaincode shim
sed -i 's|"fabric-chaincode-shim" % "1\.4\.4"|"fabric-chaincode-shim" % "2\.2\.3"|g' build.sbt
sed -i "s|'fabric-chaincode-shim', version: '1.4.4'|'fabric-chaincode-shim', version: '2.2.3'|g" fabric/java/build.gradle
# Skips running the tests.
mv ./src/test ./src/test_save
sbt assembly
popd
- name: Execute Obsidian compiler
run: |
# Install prerequisite - protobuf
wget https://github.com/protocolbuffers/protobuf/releases/download/v21.1/protoc-21.1-linux-x86_64.zip -P /tmp
unzip -d /tmp/protoc /tmp/protoc-21.1-linux-x86_64.zip
export PATH=/tmp/protoc/bin:${PATH}
protoc --version
pwd
./Obsidian/bin/obsidianc obsidian/contracts/simple/lightswitch.obs --output-path out/
ls -rotl out/LightSwitch
- name: Execute Gradle
run: |
pushd out/LightSwitch
docker run --rm -u root -v "$PWD":/home/gradle/project -w /home/gradle/project ${{ env.DOCKER_REGISTRY }}/${{ env.CUSTOM_BUILDER_IMAGE_NAME }}:${{ env.CUSTOM_BUILDER_IMAGE_VERSION }} gradle build shadowJar #-x checkstyleMain -x checkstyleTest
ls -rotl build/libs
echo "buildRoot=${PWD}" >> $GITHUB_ENV
popd
- name: Publish chaincode jar
uses: actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3
with:
name: lightswitch-chaincode
path: |
out/LightSwitch
docker-lightswitch-chaincode:
runs-on: ubuntu-latest
needs: [build-obsidian-lightswitch-chaincode]
env:
IMAGE_NAME: obsidian-lightswitch
IMAGE_VERSION: v0.0.0
BUILD_DIR: chaincode/lightswitch/docker/
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v2
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3
- name: Prepare
run: |
pushd lightswitch-chaincode/build/libs
ls -rotl ../../../${{ env.BUILD_DIR }}
cp ../../../${{ env.BUILD_DIR }}/chaincode.env .
cp ../../../${{ env.BUILD_DIR }}/connection.json .
cp ../../../${{ env.BUILD_DIR }}/Dockerfile .
cp ../../../${{ env.BUILD_DIR }}/metadata.json .
cp ../../../${{ env.BUILD_DIR }}/logging.properties .
cp ../../../${{ env.BUILD_DIR }}/docker-entrypoint.sh .
- name: Build image
run: |
pushd lightswitch-chaincode/build/libs
ls -rotl
imageTag=${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_VERSION }}
docker build --tag $imageTag .
echo "imageTag=${imageTag}" >> $GITHUB_ENV
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${{ env.DOCKER_REGIRSTY_HOST }} -u ${{ github.actor }} --password-stdin
- name: Push image
run: |
docker push ${{ env.imageTag }}
# steps:
# -
# name: Set up QEMU
# uses: docker/setup-qemu-action@v1
# -
# name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v1
# -
# name: Login to DockerHub
# uses: docker/login-action@v1
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# -
# name: Build and push
# uses: docker/build-push-action@v2
# with:
# context: "{{defaultContext}}:api"
# push: true
# tags: |
# ghcr.io/chaordicledger/swagger-ui:latest
# ghcr.io/chaordicledger/swagger-ui:0.0.1
# References: https://hyperledger-fabric.readthedocs.io/en/latest/getting_started.html
# https://github.com/hyperledger/fabric-samples/tree/main/test-network-k8s
# prerequisites:
# runs-on: ubuntu-latest
# env:
# AGNOSTIC_SETUP_DIR: setup/agnostic
# AGNOSTIC_CLEANUP_DIR: cleanup/agnostic
# UBUNTU_SETUP_DIR: setup/ubuntu
# RHEL_SETUP_DIR: setup/rhel
# steps:
# - uses: actions/checkout@v2
# - name: Setup local
# run: |
# source ${AGNOSTIC_SETUP_DIR}/local_source
# ${AGNOSTIC_SETUP_DIR}/local_setup.sh
# - name: Get kubectl
# run: ${AGNOSTIC_SETUP_DIR}/get_kubectl.sh
# - name: Get kind
# run: ${AGNOSTIC_SETUP_DIR}/get_kind.sh
# - name: Get jq
# run: ${AGNOSTIC_SETUP_DIR}/get_jq.sh
# - name: Update package manager
# run: ${UBUNTU_SETUP_DIR}/update_package_manager.sh
# - name: Get prerequisite tools
# run: ${UBUNTU_SETUP_DIR}/get_prerequisite_tools.sh
# - name: Get Docker
# run: ${UBUNTU_SETUP_DIR}/get_docker.sh
# - name: Setup Docker
# run: ${AGNOSTIC_SETUP_DIR}/setup_docker.sh
# - name: Setup Test Network for Hyperledger
# run: ${AGNOSTIC_SETUP_DIR}/setup_hyperledger.sh
# - name: Cleanup
# run: ${AGNOSTIC_CLEANUP_DIR}/cleanup_hyperledger.sh
# test:
# runs-on: ubuntu-latest
# needs: build
# steps:
# - uses: actions/checkout@v2
# - name: Install shellspec
# run: curl -fsSL https://git.io/shellspec | sh -s 0.28.1 --yes
# - name: Execute shellspec
# run: shellspec
# PrerequisiteRootCA:
# runs-on: ubuntu-latest
# needs: test
# steps:
# - uses: actions/checkout@v2
# - name: Create Root Certificate Authority (CA)
# env:
# ROOT_PASSPHRASE: ${{ secrets.ROOT_PASSPHRASE }}
# run: |
# ROOT_RESULTS_FILE_NAME="rootCAResults.json"
# COUNTRY_CODE="AU"
# STATE="WA"
# LOCATION="Northbridge"
# ORGANIZATION="Hotels"
# ORGANIZATIONAL_UNIT="Fancy"
# ROOT_COMMON_NAME="Yet another root cert authority"
# OUTPUT_DIR="."
# ./certificates/generateRootCA/bin/generateRootCA.sh -f "$ROOT_RESULTS_FILE_NAME" -p "$ROOT_PASSPHRASE" -o "$OUTPUT_DIR" -c "$COUNTRY_CODE" -s "$STATE" -l "$LOCATION" -r "$ORGANIZATION" -u "$ORGANIZATIONAL_UNIT" -n "$ROOT_COMMON_NAME"
# openssl x509 -text -noout -in rootCACert.pem
# docker:
# #needs: PrerequisiteRootCA
# runs-on: ubuntu-latest
# services:
# registry:
# image: registry:2
# ports:
# - 5000:5000
# steps:
# -
# name: Checkout
# uses: actions/checkout@v2
# -
# name: Set up QEMU
# uses: docker/setup-qemu-action@v1
# -
# name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v1
# with:
# driver-opts: network=host
# -
# name: Build and push to local registry
# uses: docker/build-push-action@v2
# with:
# context: .
# push: true
# tags: localhost:5000/name/chaordic-ledger:latest
# #tags: localhost:5000/name/chaordic-ledger:$(date +%s)
# -
# name: Inspect
# run: |
# docker buildx imagetools inspect localhost:5000/name/chaordic-ledger:latest