Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .agents
7 changes: 6 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ jobs:
steps:
- checkout:
path: ~/$CIRCLE_PROJECT_REPONAME
- run:
name: Initialize shared build tools
command: |
cd ~/$CIRCLE_PROJECT_REPONAME
bash .circleci/init-agent-skills.sh
- run:
name: Build and Upload
context: cloudsmith-creds
Expand All @@ -32,4 +37,4 @@ jobs:
mkdir -p ~/artifacts/
find . -type f -regex ".*/build/libs/.*jar" -exec cp {} ~/artifacts/ \;
- store_artifacts:
path: ~/artifacts
path: ~/artifacts
29 changes: 29 additions & 0 deletions .circleci/init-agent-skills.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
# Check out the pinned private build tools with the existing checkout identity
# or an optional read-only identity. Remove temporary key material on every
# exit.
set +x
set -euo pipefail
cd "$(dirname "$0")/.."

if [ -n "${CINCHAPI_AGENT_SKILLS_READ_KEY:-}" ]; then
umask 077
key_file=$(mktemp)
trap 'rm -f "$key_file"' EXIT
printf '%s\n' "$CINCHAPI_AGENT_SKILLS_READ_KEY" > "$key_file"
if GIT_SSH_COMMAND="ssh -i '$key_file' -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes" \
git submodule update --init .agents; then
:
else
printf '%s\n' 'The configured read key cannot fetch the pinned agent tools.' >&2
exit 1
fi
else
if git submodule update --init .agents; then
:
else
printf '%s\n' 'The checkout identity needs read access to cinchapi-agent-skills.' \
'Set CINCHAPI_AGENT_SKILLS_READ_KEY to a dedicated read-only key if needed.' >&2
exit 1
fi
fi
2 changes: 1 addition & 1 deletion .github/workflows/agents.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
concurrency:
group: agents-${{ github.event.pull_request.number || github.event.issue.number || github.event.inputs.number }}
queue: max
uses: cinchapi/cinchapi-agent-skills/.github/workflows/router.yml@31f89b30ce3f75f4b381156bf6ee1ce9752de45a
uses: cinchapi/cinchapi-agent-skills/.github/workflows/router.yml@60986ed0018283a8978f2567e4babad1036fb0c7
permissions:
contents: read
id-token: write
Expand Down
29 changes: 21 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,23 +73,36 @@ exclusions.each { exclusion ->

group = 'com.cinchapi'

// The project version is controlled externally by the "version.sh" script.
/**
* Return the publication coordinate without advancing the build counter. Branch
* suffix digits remain part of the coordinate.
*/
def getPublishedVersion = { buildVersion ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'bash', rootProject.file('.agents/tools/version'),
'--published', buildVersion.toString()
standardOutput = stdout
}
return stdout.toString().trim()
}

/**
* Return one semantic build version for this project and advance its counter.
* Fail if the shared tool cannot read the version or identify the branch.
*/
def getVersion = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'bash', 'version.sh'
commandLine 'bash', rootProject.file('.agents/tools/version'),
'--root', rootProject.projectDir.absolutePath
standardOutput = stdout
}
return stdout.toString().trim()
}
version = getVersion()

// Drop the build component from version number and use that for
// publishing
ext.mavenVersion = version.split('\\.')
ext.mavenVersion[3] = ext.mavenVersion[3].replaceAll("[0-9]+-", "-")
ext.mavenVersion[3] = ext.mavenVersion[3].replaceAll("[0-9]+", "").trim()
ext.mavenVersion = ext.mavenVersion.join(".").replace(".-", "-").replaceAll('\\.$', "")
ext.mavenVersion = getPublishedVersion(version)

sourceCompatibility = '1.8'
targetCompatibility = '1.8'
Expand Down
101 changes: 0 additions & 101 deletions version.sh

This file was deleted.