Skip to content

Commit e666098

Browse files
committed
WIP
1 parent cd3b8ab commit e666098

File tree

2 files changed

+73
-1
lines changed

2 files changed

+73
-1
lines changed

.github/workflows/ci.yaml

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