Skip to content

Commit 43dc4fc

Browse files
arrowplumCopilot
andauthored
INFRA-168 - Enable duel checkout in shared workflows (#38)
* feat(workflows): add source repository inputs to reusable execute-build workflow --------- Co-authored-by: Copilot <[email protected]>
1 parent 983ce12 commit 43dc4fc

File tree

10 files changed

+90
-45
lines changed

10 files changed

+90
-45
lines changed

.github/workflows/create-release-bundle/README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@ This workflow creates JFrog release bundles by bundling one or more builds into
88

99
## Inputs
1010

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` |
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+
| `runs-on` | The runner to use for the build | No | `ubuntu-22.04` |
21+
| `checkout-path` | Directory to checkout the shared-workflows repository into | No | `shared-workflows` |
22+
| `dry-run` | Whether to run in dry-run mode | No | `false` |
2223

2324
## Example Usage
2425

@@ -39,7 +40,6 @@ jobs:
3940
build-names: "database-build,client-build"
4041
bundle-name: database-release
4142
version: ${{ github.ref_name }}
42-
retention-days: 90
4343
dry-run: false
4444
```
4545

.github/workflows/example_reusable-integration.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,18 @@ jobs:
8989
project: database
9090
build-name: test-build
9191
build-version: v1.0.0
92-
checkout-path: project-location
92+
checkout-path: project-location # In the case of running in shared_workflows checkout-path and source-path will have the same content but we put them here by way of example.
93+
source-path: repo-source
9394
build-script: |
94-
cd project-location/.github/workflows/execute-build/test_apps/hi
95+
cd repo-source/.github/workflows/execute-build/test_apps/hi
9596
uname -m
9697
uname -a
9798
which gcc
9899
DISTRO=${{ matrix.distro }} \
99100
ARCH=${{ matrix.arch }} \
100101
EMULATED=${{ matrix.emulated }} \
101102
make docker-build
102-
artifact-directory: project-location/.github/workflows/execute-build/test_apps/hi/build
103+
artifact-directory: repo-source/.github/workflows/execute-build/test_apps/hi/build
103104
artifact-name: build-artifacts-${{ matrix.distro }}-${{ matrix.arch }}
104105
retention-days: 1 # default
105106
artifactory-url: https://aerospike.jfrog.io # default

.github/workflows/execute-build/README.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,25 @@ This workflow executes a custom build script and uploads the resulting artifacts
88

99
## Inputs
1010

11-
| Input | Description | Required | Default |
12-
| -------------------- | --------------------------------------------------------- | -------- | ----------------- |
13-
| `build-script` | Inline bash commands to execute | No\* | - |
14-
| `build-script-path` | Path to the build script file to execute | No\* | - |
15-
| `artifact-directory` | Directory that will contain all artifacts from this build | Yes | - |
16-
| `artifact-name` | Name for the uploaded artifacts | No | `build-artifacts` |
17-
| `retention-days` | Retention days for the artifacts | No | `1` |
18-
| `dry-run` | Whether to run in dry-run mode | No | `false` |
11+
| Input | Description | Required | Default |
12+
| -------------------------------- | -------------------------------------------------------------------- | -------- | ---------------------------- |
13+
| `project` | JFrog Artifactory project name | Yes | - |
14+
| `build-name` | Name for this build in artifactory | Yes | - |
15+
| `build-version` | Version for this build in artifactory | Yes | - |
16+
| `build-script` | Inline bash commands to execute | No\* | - |
17+
| `build-script-path` | Path to the build script file to execute | No\* | - |
18+
| `artifact-directory` | Directory that will contain all artifacts from this build | Yes | - |
19+
| `artifact-name` | Name for the uploaded artifacts | No | `build-artifacts` |
20+
| `retention-days` | Retention days for the artifacts | No | `1` |
21+
| `artifactory-url` | JFrog Artifactory URL | No | `https://aerospike.jfrog.io` |
22+
| `artifactory-oidc-provider-name` | OIDC provider name | No | `gh-aerospike` |
23+
| `artifactory-oidc-audience` | OIDC audience | No | `aerospike` |
24+
| `runs-on` | The runner to use for the build | No | `ubuntu-22.04` |
25+
| `checkout-path` | Directory to checkout the shared-workflows repository into | No | `shared-workflows` |
26+
| `source-repository` | Repository to checkout for source code (format owner/repo) | No | `${{ github.repository }}` |
27+
| `source-ref` | Reference to checkout for source repository (branch, tag, or commit) | No | - |
28+
| `source-path` | Directory to checkout the source repository into | No | `local` |
29+
| `dry-run` | Whether to run in dry-run mode | No | `false` |
1930

2031
\*Either `build-script` or `build-script-path` is required, but not both.
2132

.github/workflows/reusable_create-release-bundle.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
create-release-bundle:
5959
runs-on: ${{ inputs.runs-on }}
6060
env:
61-
CHECKOUT_REF: v1.1.0 # On release *must* change this to the actual release tag
61+
CHECKOUT_REF: 722626ac96e0e8569ba587bd228b9468f6e49ead # Latest commit hash for development
6262
steps:
6363
- name: Checkout shared-workflows repository
6464
uses: actions/checkout@v4

.github/workflows/reusable_execute-build.yaml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,21 @@ on:
6464
required: false
6565
type: string
6666
default: shared-workflows
67+
source-repository:
68+
description: Repository to checkout for source code (format owner/repo)
69+
required: false
70+
type: string
71+
default: ${{ github.repository }}
72+
source-ref:
73+
description: Reference to checkout for source repository (branch, tag, or commit)
74+
required: false
75+
type: string
76+
default: ""
77+
source-path:
78+
description: Directory to checkout the source repository into. If set to empty string it will not checkout the current repository.
79+
required: false
80+
type: string
81+
default: local
6782
dry-run:
6883
description: Whether to run in dry-run mode
6984
required: false
@@ -78,7 +93,7 @@ jobs:
7893
execute-build:
7994
runs-on: ${{ inputs.runs-on }}
8095
env:
81-
CHECKOUT_REF: v1.1.0 # On release *must* change this to the actual release tag
96+
CHECKOUT_REF: 722626ac96e0e8569ba587bd228b9468f6e49ead # Latest commit hash for development
8297
steps:
8398
- name: Checkout shared-workflows repository
8499
uses: actions/checkout@v4
@@ -88,6 +103,15 @@ jobs:
88103
path: ${{ inputs.checkout-path }}
89104
fetch-depth: 1
90105

106+
- name: Checkout source repository
107+
if: inputs.source-path != ''
108+
uses: actions/checkout@v4
109+
with:
110+
repository: ${{ inputs.source-repository }}
111+
ref: ${{ inputs.source-ref }}
112+
path: ${{ inputs.source-path }}
113+
fetch-depth: 1
114+
91115
- name: Set up JFrog CLI
92116
uses: jfrog/setup-jfrog-cli@2bc6e55719cd37dfb2f655a1e4f16c3440182a9f
93117
env:

.github/workflows/reusable_sign-artifacts.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
sign:
5959
runs-on: ${{ inputs.runs-on }}
6060
env:
61-
CHECKOUT_REF: v1.1.0 # On release *must* change this to the actual release tag
61+
CHECKOUT_REF: 722626ac96e0e8569ba587bd228b9468f6e49ead # Latest commit hash for development
6262
steps:
6363
- name: Checkout shared-workflows repository
6464
uses: actions/checkout@v4

.github/workflows/reusable_upload-artifacts.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
upload:
6565
runs-on: ${{ inputs.runs-on }}
6666
env:
67-
CHECKOUT_REF: v1.1.0 # On release *must* change this to the actual release tag
67+
CHECKOUT_REF: 722626ac96e0e8569ba587bd228b9468f6e49ead # Latest commit hash for development
6868
steps:
6969
- name: Checkout shared-workflows repository
7070
uses: actions/checkout@v4

.github/workflows/sign-artifacts/README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ This is a reusable GitHub Actions workflow that signs binary artifacts using GPG
1010

1111
## Inputs
1212

13-
| Name | Type | Required | Description |
14-
| ---------------- | --------- | -------- | --------------------------------------------------------------------------- |
15-
| `artifact-glob` | `string` | Yes | Glob pattern to match artifacts for signing. Example: `dist/**/*.{deb,rpm}` |
16-
| `artifact-name` | `string` | No | Name for the uploaded artifacts. Default: `signed-artifacts` |
17-
| `retention-days` | `number` | No | Number of days to retain the signed artifacts. Default: `7` |
18-
| `dry-run` | `boolean` | No | Whether to run in dry-run mode (for future compatibility). Default: `false` |
13+
| Name | Type | Required | Description |
14+
| -------------------------------- | -------- | -------- | --------------------------------------------------------------------------------------- |
15+
| `artifact-glob` | `string` | Yes | Glob pattern to match artifacts for signing. Example: `dist/**/*.{deb,rpm}` |
16+
| `artifact-name` | `string` | No | Name for the uploaded artifacts. Default: `signed-artifacts` |
17+
| `retention-days` | `number` | No | Number of days to retain the signed artifacts. Default: `1` |
18+
| `artifactory-url` | `string` | No | JFrog Artifactory URL. Default: `https://aerospike.jfrog.io` |
19+
| `artifactory-oidc-provider-name` | `string` | No | OIDC provider name. Default: `gh-aerospike` |
20+
| `artifactory-oidc-audience` | `string` | No | OIDC audience. Default: `aerospike` |
21+
| `checkout-path` | `string` | No | Directory to checkout the shared-workflows repository into. Default: `shared-workflows` |
22+
| `runs-on` | `string` | No | The runner to use for the build. Default: `ubuntu-22.04` |
1923

2024
## Secrets
2125

.github/workflows/test_execute-build-workflow.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ jobs:
1414
project: database
1515
build-name: test-build
1616
build-version: v1.0.0
17-
build-script: cd project-location/.github/workflows/execute-build/test_apps/hi && make
17+
build-script: |
18+
cd ${{ github.workspace }}/project-location/.github/workflows/execute-build/test_apps/hi && make
19+
cd ${{ github.workspace }}/content-source && cat README.md
1820
checkout-path: project-location
21+
source-path: current-source
1922
artifact-directory: project-location/.github/workflows/execute-build/test_apps/hi/build
2023
artifact-name: test-execute-build
2124
retention-days: 1 # default

.github/workflows/upload-artifacts/README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,19 @@ The workflow processes artifacts from a `build-artifacts` directory and creates
1414

1515
## Inputs
1616

17-
| Input | Description | Required | Default |
18-
| -------------------------------- | ------------------------------------- | -------- | ---------------------------- |
19-
| `project` | JFrog Artifactory project name | Yes | - |
20-
| `build-name` | Name for the unified build | Yes | - |
21-
| `version` | Version string for build info | Yes | - |
22-
| `artifactory-url` | JFrog Artifactory URL | No | `https://aerospike.jfrog.io` |
23-
| `artifactory-oidc-provider-name` | OIDC provider name for authentication | No | `gh-citrusleaf` |
24-
| `artifactory-oidc-audience` | OIDC audience for authentication | No | `citrusleaf` |
25-
| `artifact-name` | Name of the artifacts to download | No | `build-artifacts` |
26-
| `retention-days` | Retention days for the artifacts | No | `1` |
27-
| `dry-run` | Whether to run in dry-run mode | No | `false` |
17+
| Input | Description | Required | Default |
18+
| -------------------------------- | ---------------------------------------------------------- | -------- | ---------------------------- |
19+
| `project` | JFrog Artifactory project name | Yes | - |
20+
| `build-name` | Name for the unified build | Yes | - |
21+
| `version` | Version string for build info | Yes | - |
22+
| `artifactory-url` | JFrog Artifactory URL | No | `https://aerospike.jfrog.io` |
23+
| `artifactory-oidc-provider-name` | OIDC provider name for authentication | No | `gh-citrusleaf` |
24+
| `artifactory-oidc-audience` | OIDC audience for authentication | No | `citrusleaf` |
25+
| `artifact-name` | Name of the artifacts to download | No | `build-artifacts` |
26+
| `retention-days` | Retention days for the artifacts | No | `1` |
27+
| `runs-on` | The runner to use for the build | No | `ubuntu-22.04` |
28+
| `checkout-path` | Directory to checkout the shared-workflows repository into | No | `shared-workflows` |
29+
| `dry-run` | Whether to run in dry-run mode | No | `false` |
2830

2931
## Structure
3032

0 commit comments

Comments
 (0)