Skip to content

Commit

Permalink
Integration fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mirzakaracic committed Dec 24, 2024
1 parent 1a9f6b4 commit e47b2ef
Show file tree
Hide file tree
Showing 23 changed files with 526 additions and 106 deletions.
16 changes: 9 additions & 7 deletions .github/actions/build-and-test/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ inputs:
required: false
default: "latest"
description: "Server docker image tag"
jfrog_docker_username:
jfrog-docker-username:
required: true
description: ""
jfrog_docker_token:
jfrog-docker-token:
required: true
description: ""
run-tests:
Expand All @@ -28,25 +28,27 @@ inputs:
runs:
using: "composite"
steps:
# Using script to set profile since we would like to have the sticky effect. Set it once and have it
# remain for remainder of the job
- 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' }}
uses: ./.github/actions/run-ee-server
with:
use-server-rc: ${{ inputs.use-server-rc }}
server-tag: ${{ inputs.server-tag }}
docker-hub-username: ${{ inputs.jfrog_docker_username }}
docker-hub-password: ${{ inputs.jfrog_docker_token }}
docker-hub-username: ${{ inputs.jfrog-docker-username }}
docker-hub-password: ${{ inputs.jfrog-docker-token }}

- name: Test
- name: Run tests
shell: bash
if: ${{ inputs.run-tests == true }}
working-directory: test
Expand Down
36 changes: 0 additions & 36 deletions .github/actions/fast-forward-merge/action.yaml

This file was deleted.

51 changes: 51 additions & 0 deletions .github/actions/github-release/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Create github release
description: Creates a github release

inputs:
artifact-version:
description: ""
required: true
github-token:
description: ""
required: true

runs:
using: composite
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Get previous tag
shell: bash
id: get-prev-tag
run: |
# Fetch all tags
git fetch --tags
echo "previous-tag=$(git tag --sort=-creatordate | sed -n '1p')" >> $GITHUB_OUTPUT
# Extract commit messages between previous tag and the current tag.
- name: Get release notes
shell: bash
id: release-notes
run: |
notes=$(git log "${{ steps.get-previous-tag.outputs.previous-tag }}..HEAD" --pretty=format:"%s" --no-merges)
# GitHub Actions requires that multiline output is escaped:
notes="${notes//'%'/'%25'}"
notes="${notes//$'\n'/'%0A'}"
notes="${notes//$'\r'/'%0D'}"
echo "notes=$notes" >> $GITHUB_OUTPUT
- name: Debug
shell: bash
run: |
echo "artifact-version: ${{ inputs.artifact-version }}"
echo "body: ${{ steps.release-notes.outputs.notes }}"
- uses: rickstaa/action-create-tag@v1
id: "tag_create"
with:
tag: ${{ inputs.artifact-version }}
tag_exists_error: false
message: "Latest release"
59 changes: 47 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,75 @@ 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
- 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: 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].target = $targetPattern |
.files[2].pattern = $publicPomPattern |
.files[2].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 \
--module=${{ inputs.artifact-id }} \
--build-name=clients-java-push-to-dev \
--build-number=${{ github.run_number }}
66 changes: 66 additions & 0 deletions .github/actions/publish-to-sonatype/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Publish artifacts to Sonatype
description: "Publishes artifacts to Sonatype"

inputs:
jfrog-releases-repo-name:
description: ""
required: false
default: clients-maven-dev-local
jfrog-snapshots-repo-name:
description: ""
required: false
default: clients-maven-dev-local
jfrog-platform-url:
description: ""
required: false
default: https://aerospike.jfrog.io
oidc-provider:
description: ""
required: true
oidc-audience:
description: ""
required: true
artifact-name:
description: ""
required: true
artifact-version:
description: ""
required: true
staging-folder:
description: ""
required: false
default: staging
target-repository:
description: ""
required: false
default: clients-maven-stage-local

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: Create staging folder
shell: bash
run: |
mkdir -p ${{ inputs.staging-folder }}
- name: Download artifacts from JFrog
shell: bash
working-directory: ${{ inputs.staging-folder }}
run: |
jf rt dl "${{ inputs.target-repository }}/com/aerospike/${{ inputs.artifact-name }}/${{ inputs.artifact-version }}/*" .
- name: Debug list downloaded content
shell: bash
working-directory: ${{ inputs.staging-folder }}
run: |
ls -la
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
28 changes: 17 additions & 11 deletions .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 @@ -37,16 +38,16 @@ on:
type: string
required: true
secrets:
GPG_SECRET_KEY:
JFROG_OIDC_PROVIDER:
required: true
GPG_PASS:
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 @@ -56,18 +57,23 @@ jobs:
with:
distribution: "semeru" # See 'Supported distributions' for available options
java-version: ${{ inputs.java-version }}
gpg-private-key: ${{ secrets.GPG_SECRET_KEY }}
gpg-passphrase: ${{ secrets.GPG_PASS }}

# This is needed so we can authenticate and get the credentials to be able to pull AE RC from JFrog
- 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: Build and test
uses: ./.github/actions/build-and-test
with:
crypto-type: ${{ inputs.crypto-type }}
server-tag: ${{ inputs.server-tag }}
use-server-rc: ${{ inputs.use-server-rc }}

- name: Publish to JFrog
if: ${{ !cancelled() && inputs.upload-artifacts == true }}
uses: ./.github/actions/publish-to-jfrog
with:
crypto-type: ${{ inputs.crypto-type }}
jfrog-docker-username: ${{ steps.setup-jfrog-cli.outputs.oidc-user }}
jfrog-docker-token: ${{ steps.setup-jfrog-cli.outputs.oidc-token }}
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 }}'"
Loading

0 comments on commit e47b2ef

Please sign in to comment.