Skip to content

Commit 2c5f6a4

Browse files
committed
WIP
1 parent cd3b8ab commit 2c5f6a4

File tree

2 files changed

+74
-1
lines changed

2 files changed

+74
-1
lines changed

.github/workflows/ci.yaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Rust CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
workflow_dispatch:
7+
8+
jobs:
9+
prepare:
10+
name: Determine image tag
11+
runs-on:
12+
group: Azure_runners
13+
#if: |
14+
# github.ref_name == 'main' ||
15+
# startsWith(github.head_ref, 'feature/') ||
16+
# startsWith(github.head_ref, 'bugfix/') ||
17+
# (github.event_name == 'workflow_dispatch' && (startsWith(github.ref_name, 'feature/') || startsWith(github.ref_name, 'bugfix/')))
18+
outputs:
19+
image_tag: ${{ steps.determine-tag.outputs.image_tag }}
20+
jar_path: ${{ steps.jar-path.outputs.jar_path }}
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Determine base tag
28+
id: determine-tag
29+
run: |
30+
if [ "${{ github.event_name }}" = "pull_request" ] ; then
31+
SHORT_SHA=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-8)
32+
else
33+
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-8)
34+
fi
35+
36+
if [ "${{ github.ref_name }}" = "main" ] ; then
37+
echo "Processing main branch"
38+
echo "image_tag=dev-${SHORT_SHA}" | tee -a $GITHUB_OUTPUT
39+
else
40+
# This covers feature/ and bugfix/ branches
41+
echo "Processing feature/bugfix branch ${{ github.head_ref }}"
42+
echo "image_tag=feature-${SHORT_SHA}" | tee -a $GITHUB_OUTPUT
43+
fi
44+
45+
- name: Build jar
46+
id: jar-path
47+
run: |
48+
./gradlew build
49+
echo "jar_path=$(./gradlew properties | grep jarPathForOCI | cut -d" " -f2)" | tee -a $GITHUB_OUTPUT
50+
env:
51+
ORG_GRADLE_PROJECT_nexusUser: ${{ secrets.NEXUS_USERNAME }}
52+
ORG_GRADLE_PROJECT_nexusPassword: ${{ secrets.NEXUS_PASSWORD }}
53+
54+
build-oci-image:
55+
name: Build OCI images
56+
needs: prepare
57+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/docker-build.yml@feature/improve-docker-build
58+
with:
59+
image-name: docker-regis.iex.ec/iexec-blockchain-adpter-api
60+
image-tag: ${{ needs.prepare.outputs.image_tag }}
61+
dockerfile: Dockerfile
62+
context: .
63+
registry: docker-regis.iex.ec
64+
push: true
65+
security-scan: true
66+
security-report: "sarif"
67+
hadolint: true
68+
platforms: linux/amd64
69+
build-args: |
70+
jar=${{ needs.prepare.outputs.jar_path }}
71+
secrets:
72+
username: ${{ secrets.NEXUS_USERNAME }}
73+
password: ${{ secrets.NEXUS_PASSWORD }}

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
buildJavaProject(
33
integrationTestsEnvVars: ['BROKER_PRIVATE_KEY'],
44
shouldPublishJars: true,
5-
shouldPublishDockerImages: true)
5+
shouldPublishDockerImages: false)

0 commit comments

Comments
 (0)