Skip to content

Commit 71ff744

Browse files
committed
fix: resolve merge conflicts in reusable_sign-artifacts.yaml
- Merge NuGet signing functionality from HEAD branch - Merge Artifactory/OIDC inputs from origin/main branch - Fix parameter naming consistency (artifact-name vs output-dir)
2 parents e48b302 + 222b6c5 commit 71ff744

26 files changed

+2066
-178
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Extract Version from Tag
2+
description: Extracts version from Git tag and sets output variables for use in workflows
3+
inputs:
4+
tag-prefix:
5+
description: "Prefix to remove from tag (default: 'v')"
6+
required: false
7+
default: v
8+
runs:
9+
using: composite
10+
steps:
11+
- name: Extract Version from Tag
12+
if: startsWith(github.ref, 'refs/tags/')
13+
shell: bash
14+
run: |
15+
TAG=${GITHUB_REF##*/}
16+
VERSION=${TAG#${{ inputs.tag-prefix }}}
17+
echo "version=$VERSION" >> $GITHUB_OUTPUT
18+
echo "git_tag=$TAG" >> $GITHUB_OUTPUT
19+
echo "Extracted version: $VERSION from tag: $TAG"
20+
echo "Tag prefix used: ${{ inputs.tag-prefix }}"
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Create Release Bundle Workflow
2+
3+
Create JFrog release bundles from a configurable list of build names.
4+
5+
## Overview
6+
7+
This workflow creates JFrog release bundles by bundling one or more builds into a single distributable package.
8+
9+
## Inputs
10+
11+
| Input | Description | Required | Default |
12+
| -------------------------------- | ---------------------------------------------- | -------- | ---------------------------- |
13+
| `project` | JFrog Artifactory project name | Yes | - |
14+
| `build-names` | Comma-separated list of build names to include | Yes | - |
15+
| `bundle-name` | Name for the release bundle | Yes | - |
16+
| `version` | Version of the release bundle | Yes | - |
17+
| `artifactory-url` | JFrog Artifactory URL | No | `https://aerospike.jfrog.io` |
18+
| `artifactory-oidc-provider-name` | OIDC provider name for authentication | No | `gh-aerospike` |
19+
| `artifactory-oidc-audience` | OIDC audience for authentication | No | `aerospike` |
20+
| `retention-days` | Retention days for the release bundle | No | `30` |
21+
| `dry-run` | Whether to run in dry-run mode | No | `false` |
22+
23+
## Example Usage
24+
25+
### Basic release bundle creation
26+
27+
```yaml
28+
name: Create Release Bundle
29+
on:
30+
workflow_dispatch:
31+
push:
32+
tags: ["v*"]
33+
34+
jobs:
35+
create-release-bundle:
36+
uses: ./.github/workflows/reusable_create-release-bundle.yaml
37+
with:
38+
project: database
39+
build-names: "database-build,client-build"
40+
bundle-name: database-release
41+
version: ${{ github.ref_name }}
42+
retention-days: 90
43+
dry-run: false
44+
```
45+
46+
## Prerequisites
47+
48+
- JFrog Artifactory instance with OIDC authentication configured
49+
- GitHub Actions with OIDC token access to Artifactory
50+
- Existing builds in JFrog Artifactory that will be included in the bundle
51+
52+
## Testing
53+
54+
Run the basic test suite:
55+
56+
```bash
57+
.github/workflows/create-release-bundle/test-entrypoint.sh
58+
```
59+
60+
## Integration
61+
62+
This workflow is designed to be used as part of larger CI/CD pipelines:
63+
64+
1. **Build Phase**: Use build-artifacts workflow to create builds
65+
2. **Sign Phase**: GPG sign build-artifacts
66+
3. **Upload Phase**: Use upload-artifacts workflow to upload to JFrog
67+
4. **Bundle Phase**: Use this workflow to create release bundles
68+
69+
```yaml
70+
jobs:
71+
build:
72+
uses: ./.github/workflows/reusable_execute-build.yaml
73+
with:
74+
build-script: ./build.sh
75+
artifact-directory: dist
76+
77+
upload:
78+
needs: build
79+
uses: ./.github/workflows/reusable_upload-artifacts.yaml
80+
with:
81+
project: my-project
82+
build-name: my-build
83+
version: v1.0.0
84+
85+
create-release-bundle:
86+
needs: upload
87+
uses: ./.github/workflows/reusable_create-release-bundle.yaml
88+
with:
89+
project: my-project
90+
build-names: "my-build-deb,my-build-rpm"
91+
bundle-name: my-release
92+
version: v1.0.0
93+
```
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
export PS4='+($LINENO): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
5+
trap 'handle_error ${LINENO}' ERR
6+
7+
# shellcheck disable=SC2317
8+
handle_error() {
9+
local exit_code=$?
10+
local line_number=$1
11+
echo "Error: Command failed with exit code $exit_code at line $line_number" >&2
12+
exit 1
13+
}
14+
15+
error() {
16+
local reason="${1:-}"
17+
if [[ -n "$reason" ]]; then
18+
echo "Error: $reason" >&2
19+
else
20+
echo "Error" >&2
21+
fi
22+
exit 1
23+
}
24+
25+
# Default values
26+
DRY_RUN="false"
27+
28+
show_help() {
29+
echo "Usage: $0 --project <project> --build-names <builds> --bundle-name <name> --version <version> [OPTIONS]" >&2
30+
echo "" >&2
31+
echo "Create JFrog release bundles from a configurable list of build names" >&2
32+
echo "" >&2
33+
echo "Required Arguments:" >&2
34+
echo " --project <project> JFrog Artifactory project name" >&2
35+
echo " --build-names <builds> Comma-separated list of build names to include" >&2
36+
echo " --bundle-name <name> Name for the release bundle" >&2
37+
echo " --version <version> Version of the release bundle" >&2
38+
echo "" >&2
39+
echo "Options:" >&2
40+
echo " --dry-run Show what would be done without actually doing it" >&2
41+
echo " --help, -h Show this help message" >&2
42+
echo "" >&2
43+
echo "Examples:" >&2
44+
echo " $0 --project database --build-names 'db-build-1,db-build-2' --bundle-name database-release --version v1.0.0" >&2
45+
echo " $0 --project app --build-names 'app-build' --bundle-name app-release --version v2.1.0 --dry-run" >&2
46+
}
47+
48+
# Parse command line arguments
49+
while [[ $# -gt 0 ]]; do
50+
case $1 in
51+
--project)
52+
PROJECT="$2"
53+
shift 2
54+
;;
55+
--build-names)
56+
BUILD_NAMES="$2"
57+
shift 2
58+
;;
59+
--bundle-name)
60+
BUNDLE_NAME="$2"
61+
shift 2
62+
;;
63+
--version)
64+
VERSION="$2"
65+
shift 2
66+
;;
67+
--dry-run)
68+
DRY_RUN="true"
69+
shift
70+
;;
71+
--help|-h)
72+
show_help
73+
exit 0
74+
;;
75+
-*)
76+
echo "Unknown option: $1" >&2
77+
show_help
78+
exit 1
79+
;;
80+
*)
81+
echo "Unexpected positional argument: $1" >&2
82+
show_help
83+
exit 1
84+
;;
85+
esac
86+
done
87+
88+
# Validate required arguments
89+
if [[ -z "${PROJECT:-}" ]]; then
90+
echo "--project is required."
91+
show_help
92+
exit 1
93+
fi
94+
95+
if [[ -z "${BUILD_NAMES:-}" ]]; then
96+
echo "--build-names is required."
97+
show_help
98+
exit 1
99+
fi
100+
101+
if [[ -z "${BUNDLE_NAME:-}" ]]; then
102+
echo "--bundle-name is required."
103+
show_help
104+
exit 1
105+
fi
106+
107+
if [[ -z "${VERSION:-}" ]]; then
108+
echo "--version is required."
109+
show_help
110+
exit 1
111+
fi
112+
113+
# Wrapper function that either executes or echoes commands
114+
run() {
115+
if [[ "$DRY_RUN" == "true" ]]; then
116+
local green='\033[0;32m'
117+
local reset='\033[0m'
118+
echo -e "${green} $*${reset}" >&2
119+
else
120+
"$@"
121+
fi
122+
}
123+
124+
main() {
125+
echo "Command line: $0 $*" >&2
126+
127+
if [[ "$DRY_RUN" == "true" ]]; then
128+
echo "Would execute create-release-bundle workflow" >&2
129+
echo "The following JFrog commands would be executed:" >&2
130+
echo "" >&2
131+
else
132+
echo "Executing create-release-bundle workflow" >&2
133+
fi
134+
135+
echo "Project: $PROJECT" >&2
136+
echo "Build names: $BUILD_NAMES" >&2
137+
echo "Bundle name: $BUNDLE_NAME" >&2
138+
echo "Version: $VERSION" >&2
139+
echo "Dry run: $DRY_RUN" >&2
140+
141+
# Convert comma-separated build names to array
142+
IFS=',' read -ra BUILD_ARRAY <<< "$BUILD_NAMES"
143+
mkdir -p build-artifacts
144+
# Create the release bundle spec file
145+
cat > build-artifacts/release-bundle-spec.json <<EOF
146+
{
147+
"name": "$BUNDLE_NAME",
148+
"version": "$VERSION",
149+
"description": "Release for build version $VERSION",
150+
"files": [
151+
$(for ((i=0; i<${#BUILD_ARRAY[@]}; i++)); do
152+
build_name=$(echo "${BUILD_ARRAY[i]}" | xargs)
153+
if [[ -n "$build_name" ]]; then
154+
echo " {"
155+
echo " \"project\": \"$PROJECT\","
156+
echo " \"build\": \"$build_name/$VERSION\""
157+
if [[ $i -lt $((${#BUILD_ARRAY[@]}-1)) ]]; then
158+
echo " },"
159+
else
160+
echo " }"
161+
fi
162+
fi
163+
done)
164+
]
165+
}
166+
EOF
167+
168+
echo "Spec file:" >&2
169+
cat build-artifacts/release-bundle-spec.json >&2
170+
171+
# Create the release bundle
172+
run jf release-bundle-create "$BUNDLE_NAME" "$VERSION" \
173+
--spec build-artifacts/release-bundle-spec.json \
174+
--project="$PROJECT" \
175+
--signing-key="aerospike"
176+
177+
echo "Create release bundle workflow completed successfully!" >&2
178+
}
179+
180+
main "$@"

0 commit comments

Comments
 (0)