Skip to content

Commit

Permalink
Integration fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mirzakaracic committed Dec 19, 2024
1 parent 1a9f6b4 commit 7fb1102
Show file tree
Hide file tree
Showing 18 changed files with 253 additions and 89 deletions.
4 changes: 2 additions & 2 deletions .github/actions/build-and-test/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ runs:
- name: Stage crypto
shell: bash
run: |
./set_cypto ${{ inputs.crypto-type }}
./set_crypto ${{ inputs.crypto-type }}
- name: Build
shell: bash
run: mvn clean install -P ${{ inputs.crypto-type }}
run: mvn clean install

- name: Run EE server
if: ${{ inputs.run-tests == 'true' }}
Expand Down
36 changes: 0 additions & 36 deletions .github/actions/fast-forward-merge/action.yaml

This file was deleted.

102 changes: 90 additions & 12 deletions .github/actions/publish-to-jfrog/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,40 +13,118 @@ inputs:
jfrog-platform-url:
description: ""
required: false
default: https://aerospike.jfrog.io/
default: https://aerospike.jfrog.io
oidc-provider:
description: ""
required: false
default: gh-aerospike-clients
required: true
oidc-audience:
description: ""
required: false
default: aerospike/clients
required: true
crypto-type:
description: ""
required: false
default: gnu
artifact-name:
description: ""
required: true
artifact-id:
description: ""
required: true
artifact-version:
description: ""
required: true
deploy-spec-path:
description: ""
required: false
default: deploy-resources

runs:
using: "composite"
steps:
- name: Set up JFrog credentials
id: setup-jfrog-cli
uses: jfrog/setup-jfrog-cli@v4
env:
JF_URL: ${{ inputs.jfrog-platform-url }}
with:
version: 2.72.2
oidc-provider-name: ${{ inputs.oidc-provider }}
oidc-audience: ${{ inputs.oidc-audience }}

- name: Set crypto dependency
- uses: s4u/[email protected]
with:
servers: '[{"id": "jfrog", "username": "${{ steps.setup-jfrog-cli.outputs.oidc-user }}", "password": "${{ steps.setup-jfrog-cli.outputs.oidc-token }}"}]'

- name: Configure jf cli
shell: bash
run: |
./set_crypto ${{ inputs.crypto-type }}
jf mvn-config \
--repo-deploy-releases=${{ inputs.jfrog-releases-repo-name }} \
--repo-deploy-snapshots=${{ inputs.jfrog-snapshots-repo-name }}
#- name: Deploy client release
# shell: bash
# working-directory: client
# run: |
# # jf mvn source:jar javadoc:jar install deploy:deploy-file \
# # -DartifactId=${{ inputs.artifact-id }} \
# # -DpomFile=src/resources/${{ inputs.crypto-type }}_pom.xml \
# # -Dfile=target/${{ inputs.artifact-name }}.jar \
# # -Dfiles=target/${{ inputs.artifact-name }}-jar-with-dependencies.jar \
# # -Dtypes=jar \
# # -Dclassifiers=jar-with-dependencies \
# # -Dsources=target/${{ inputs.artifact-name }}-sources.jar \
# # -Djavadoc=target/${{ inputs.artifact-name }}-javadoc.jar \
# # -DrepositoryId=jfrog \
# # -DgeneratePom=false \
# # -Durl=${{ inputs.jfrog-platform-url }}/artifactory/${{ inputs.jfrog-releases-repo-name }}
# #
# # jf mvn org.apache.maven.plugins:maven-deploy-plugin:3.1.3:deploy-file \
# # -DartifactId=${{ inputs.artifact-id }} \
# # -DpomFile=src/resources/${{ inputs.crypto-type }}_pom.xml \
# # -Dfile=target/${{ inputs.artifact-name }}.jar \
# # -Dfiles=target/${{ inputs.artifact-name }}-jar-with-dependencies.jar \
# # -Dsources=target/${{ inputs.artifact-name }}-sources.jar \
# # -Djavadoc=target/${{ inputs.artifact-name }}-javadoc.jar \
# # -Dtypes=jar \
# # -Dclassifiers=jar-with-dependencies \
# # -DrepositoryId=jfrog \
# # -DgeneratePom=false \
# # -Durl=${{ inputs.jfrog-platform-url }}/artifactory/${{ inputs.jfrog-releases-repo-name }}
# jf mvn source:jar javadoc:jar install

#- name: Publish build info
# shell: bash
# run: |
# # Collect environment variables for the build
# jf rt bce
# # Collect VCS details from git and add them to the build
# jf rt bag
# # Publish build info
# jf rt bp clients-java-push-to-dev ${{ github.run_number }}
#
- name: Generate deploy spec
shell: bash
working-directory: client
run: |
jq --arg targetPattern "${{ inputs.jfrog-releases-repo-name }}/com/aerospike/${{ inputs.artifact-id }}/${{ inputs.artifact-version }}/" \
--arg publicPomPattern "deploy-resources/${{ inputs.crypto-type }}_pom.xml" \
--arg publicPomTarget "${{ inputs.jfrog-releases-repo-name }}/com/aerospike/${{ inputs.artifact-id }}/${{ inputs.artifact-version }}/${{ inputs.artifact-name }}.pom" \
'
.files[0].target = $targetPattern |
.files[1].pattern = $publicPomPattern |
.files[1].target = $publicPomTarget
' ${{ inputs.deploy-spec-path }}/publish-spec.json.template > ${{ inputs.deploy-spec-path }}/publish-spec.json
- name: Debug deploy spec
shell: bash
working-directory: client
run: |
cat ${{ inputs.deploy-spec-path }}/publish-spec.json
- name: Deploy release
- name: Overwrite default pom with public release pom
shell: bash
working-directory: client
run: |
jf mvn-config --repo-deploy-releases=${{ inputs.jfrog-releases-repo-name }} --repo-deploy-snapshots=${{ inputs.jfrog-snapshots-repo-name }}
jf mvn source:jar javadoc:jar deploy -Dusername=${{ steps.setup-jfrog-cli.outputs.oidc-user }} ${{ steps.setup-jfrog-cli.outputs.oidc-token }}
jf rt bp
jf rt upload --spec=${{ inputs.deploy-spec-path }}/publish-spec.json \
--build-name=clients-java-push-to-dev \
--build-number=${{ github.run_number }}
2 changes: 1 addition & 1 deletion .github/workflows/build-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
needs: java-version
strategy:
matrix:
crypto-type: ["bouncycastle", "gnu"]
crypto-type: [bouncycastle, gnu]
with:
java-version: ${{ needs.java-version.outputs.java-version }}
branch: ${{ inputs.branch }}
Expand Down
30 changes: 29 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Build artifacts
run-name: Build artifact for ${{ inputs.crypto-type }} ${{ inputs.java-version }}

permissions:
# This is required for requesting the OIDC token
Expand Down Expand Up @@ -41,12 +42,16 @@ on:
required: true
GPG_PASS:
required: true
JFROG_OIDC_PROVIDER:
required: true
JFROG_OIDC_AUDIENCE:
required: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout client
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
Expand All @@ -66,8 +71,31 @@ jobs:
server-tag: ${{ inputs.server-tag }}
use-server-rc: ${{ inputs.use-server-rc }}

- name: Get artifact name
id: get-artifact-name
working-directory: client
run: |
echo artifact-name=$(mvn help:evaluate -Dexpression=project.build.finalName -q -DforceStdout) >> $GITHUB_OUTPUT
- name: Get artifact ID
id: get-artifact-id
working-directory: client
run: |
echo artifact-id="aerospike-client${{ inputs.crypto-type == 'bouncycastle' && '-bc' || '' }}-jdk${{ inputs.java-version }}" >> $GITHUB_OUTPUT
- name: Get artifact version
id: get-artifact-version
working-directory: client
run: |
echo artifact-version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) >> $GITHUB_OUTPUT
- name: Publish to JFrog
if: ${{ !cancelled() && inputs.upload-artifacts == true }}
uses: ./.github/actions/publish-to-jfrog
with:
crypto-type: ${{ inputs.crypto-type }}
oidc-provider: ${{ secrets.JFROG_OIDC_PROVIDER }}
oidc-audience: ${{ secrets.JFROG_OIDC_AUDIENCE }}
artifact-name: ${{ steps.get-artifact-name.outputs.artifact-name }}
artifact-id: ${{ steps.get-artifact-id.outputs.artifact-id }}
artifact-version: ${{ steps.get-artifact-version.outputs.artifact-version }}
5 changes: 3 additions & 2 deletions .github/workflows/promote-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
name: Promot from stage to prod
uses: ./.github/workflows/promote.yaml
with:
build-number: ${{ inputs.build-number }}
target-repository: client-maven-stage-local
build-number: ${{ inputs.build-number }}
target-repository: clients-maven-stage-local
target-branch: dev-stage
secrets: inherit
17 changes: 14 additions & 3 deletions .github/workflows/promote-to-stage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,25 @@ jobs:
env:
JF_URL: ${{ vars.JFROG_PLATFORM_URL }}
with:
oidc-provider-name: ${{ inputs.oidc-provider }}
oidc-audience: ${{ inputs.oidc-audience }}
oidc-provider-name: ${{ secrets.JFROG_OIDC_PROVIDER }}
oidc-audience: ${{ secrets.JFROG_OIDC_AUDIENCE }}

- name: Get info
id: get-build-info
run: |
echo build-info=$(jf rt curl /api/build/clients-java-push-to-dev/${{ inputs.build-number }}) >> $GITHUB_OUTPUT
- name: Get commit hash from repo
id: get-commit-hash
run: |
echo commit-hash=$(echo '${{ steps.get-build-info.outputs.build-info }}' | jq -r '.buildInfo.vcs[].revision') >> $GITHUB_OUTPUT
- name: Get build name
id: get-build-name
run: |
echo build-name=$(echo '${{ steps.get-build-info.outputs.build-info }}' | jq -r '.buildInfo.name') >> $GITHUB_OUTPUT
- name: Debug
run: |
echo ${{ steps.get-build-info.outputs.build-info }}
echo "commit-hash: '${{ steps.get-commit-hash.outputs.commit-hash }}'"
echo "build-name: '${{ steps.get-build-name.outputs.build-name }}'"
46 changes: 32 additions & 14 deletions .github/workflows/promote.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_call:
inputs:
build-number:
type: number
type: string
description: Build number used to build artifact to be promoted
target-repository:
type: string
Expand All @@ -25,8 +25,8 @@ jobs:
env:
JF_URL: ${{ vars.JFROG_PLATFORM_URL }}
with:
oidc-provider-name: ${{ inputs.oidc-provider }}
oidc-audience: ${{ inputs.oidc-audience }}
oidc-provider-name: ${{ secrets.JFROG_OIDC_PROVIDER }}
oidc-audience: ${{ secrets.JFROG_OIDC_AUDIENCE }}

- name: Get info
id: get-build-info
Expand All @@ -36,25 +36,43 @@ jobs:
- name: Get commit hash from repo
id: get-commit-hash
run: |
echo commit-hash=$(steps.get-build-info.outputs.build-info | jq -r '.vcs[].revision') >> $GITHUB_OUTPUT
echo commit-hash=$(echo '${{ steps.get-build-info.outputs.build-info }}' | jq -r '.buildInfo.vcs[].revision') >> $GITHUB_OUTPUT
- name: Get commit hash from repo
- name: Get build name
id: get-build-name
run: |
echo build-name=$(steps.get-build-info.outputs.build-info | jq -r '.name') >> $GITHUB_OUTPUT
echo build-name=$(echo '${{ steps.get-build-info.outputs.build-info }}' | jq -r '.buildInfo.name') >> $GITHUB_OUTPUT
- name: Debug
run: |
echo ${{ steps.get-build-info.outputs.build-info }}
echo ${{ steps.get-build-info.outputs.build-name }}
echo "commit-hash: '${{ steps.get-commit-hash.outputs.commit-hash }}'"
echo "build-name: '${{ steps.get-build-name.outputs.build-name }}'"
# Needed since we are using actions which are part of the repository
- name: Checkout
uses: actions/checkout@v4
with:
# Fetch the whole history to prevent unrelated history errors
fetch-depth: "0"
ref: ${{ inputs.target-branch }}
token: ${{ secrets.CLIENT_BOT_PAT }}

- name: Fast forward
shell: bash
run: git merge --ff-only ${{ inputs.ref-to-merge }}

- name: Merge commit hash from source to target branch
uses: ./github/actions/fast-forward-merge
- name: Add tagging message
uses: stefanzweifel/git-auto-commit-action@v4
with:
ref-to-merge: ${{ steps.get-build-info.outputs.build-info }}
base-branch: ${{ inputs.target-branch }}
git-bot-token: ${{ secrets.CLIENT_BOT_PAT }}
commit_message: "Promote to prod [skip ci]"
commit_author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
tagging_message: Promote to PROD
branch: ${{ inputs.target-branch }}

- name: Upload changes to remote head branch
shell: bash
run: git push

- name: Promote build
run: |
jf rt build-promote ${{ steps.get-build-info.outputs.build-name }} ${{ inputs.build-number }} ${{ inputs.target-repository }}
jf rt build-promote ${{ steps.get-build-name.outputs.build-name }} ${{ inputs.build-number }} ${{ inputs.target-repository }}
2 changes: 1 addition & 1 deletion benchmarks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.aerospike</groupId>
<artifactId>aerospike-parent</artifactId>
<version>9.0.2</version>
<version>${revision}</version>
</parent>
<artifactId>aerospike-benchmarks</artifactId>
<packaging>jar</packaging>
Expand Down
12 changes: 12 additions & 0 deletions client/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"files": [
{
"pattern": "target/*.jar",
"target": "test"
},
{
"pattern": "one",
"target": "another"
}
]
}
12 changes: 12 additions & 0 deletions client/config.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"files": [
{
"pattern": "target/*.jar",
"target": ""
},
{
"pattern": "",
"target": ""
}
]
}
Loading

0 comments on commit 7fb1102

Please sign in to comment.