-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Justin Kolberg <[email protected]>
- Loading branch information
1 parent
a994849
commit beb3e22
Showing
6 changed files
with
357 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: 'Publish release test' | ||
|
||
run-name: Testing | ||
|
||
on: | ||
pr: | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
create-release: | ||
name: Create Github release | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: ncipollo/release-action@v1 | ||
with: | ||
name: test-${{ github.run_number }} | ||
commit: ${{ github.sha }} | ||
tag: test-${{ github.run_number }} | ||
|
||
draft: true | ||
generateReleaseNotes: true | ||
prerelease: false | ||
|
||
allowUpdates: true | ||
omitBodyDuringUpdate: true | ||
omitNameDuringUpdate: true | ||
|
||
artifacts: "artifacts/*/*" | ||
artifactErrorsFailBuild: true | ||
replacesArtifacts: true | ||
|
||
body: | | ||
This release packages [${{ github.run_number }}][collector_release]. | ||
The changelog below is for the package itself, rather than the Sumo | ||
Logic Distribution for OpenTelemetry Collector. The changelog for | ||
the Sumo Logic Distribution for OpenTelemetry Collector can be found | ||
on the collector's [release page][collector_release]. | ||
[collector_release]: https://github.com/SumoLogic/sumologic-otel-collector/releases/tag/v${{ needs.get-version.outputs.version }}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,196 @@ | ||
name: 'Publish release' | ||
|
||
run-name: > | ||
${{ format('Publish Release for Workflow: {0}', inputs.workflow_id) }} | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
workflow_id: | ||
description: | | ||
Workflow Run ID from this repository to fetch artifacts from for this | ||
release. | ||
required: true | ||
type: string | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
get-version: | ||
name: Get application version for this revision | ||
runs-on: ubuntu-latest | ||
outputs: | ||
sha: ${{ steps.get-sha.outputs.git-sha }} | ||
otc-version: ${{ steps.get-version.outputs.otc-version }} | ||
sumo-version: ${{ steps.get-version.outputs.sumo-version }} | ||
version: ${{ steps.get-version.outputs.version }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Outuput Workflow ID | ||
run: echo ::notice title=Workflow ID::${{ inputs.workflow_id }} | ||
|
||
- name: Output Workflow URL | ||
run: | | ||
repo_url="https://github.com/SumoLogic/sumologic-otel-collector-packaging" | ||
url="${repo_url}/actions/runs/${{ inputs.workflow_id }}" | ||
echo ::notice title=Workflow URL::${url} | ||
- name: Determine Workflow Run ID from workflow | ||
id: get-run-number | ||
run: | | ||
workflow="11673248730" | ||
run_number=$(gh run view "${workflow}" --json number -t '{{.number}}') | ||
echo "run-number=$run_number" >> $GITHUB_OUTPUT | ||
- name: Output Workflow Run Number | ||
run: | | ||
run_number=${{ steps.get-run-number.outputs.run-number }} | ||
echo ::notice title=Workflow Run Number::${run_number} | ||
- name: Download otelcol-sumo artifact from workflow | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: otelcol-sumo-linux_amd64 | ||
path: artifacts/ | ||
merge-multiple: true | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
run-id: ${{ inputs.workflow_id }} | ||
|
||
- name: Determine version from artifact | ||
id: get-version | ||
run: | | ||
artifact="artifacts/otelcol-sumo-linux_amd64" | ||
chmod +x "${artifact}" | ||
script="ci/get_version_from_binary.sh" | ||
core="$("$script" core "${artifact}")" | ||
sumo="$("$script" sumo "${artifact}")" | ||
run_number=${{ steps.get-run-number.outputs.run-number }} | ||
echo "otc-version=$core" >> $GITHUB_OUTPUT | ||
echo "sumo-version=$sumo" >> $GITHUB_OUTPUT | ||
echo "binary-version=${core}-sumo-${sumo}" >> $GITHUB_OUTPUT | ||
echo "version=${core}-${run_number}" >> $GITHUB_OUTPUT | ||
- name: Output Binary Version | ||
run: | | ||
binary_version=${{ steps.get-version.outputs.binary-version }} | ||
echo ::notice title=Binary Version::${binary_version} | ||
- name: Output Package Version | ||
run: | | ||
package_version=${{ steps.get-version.outputs.version }} | ||
echo ::notice title=Package Version::${package_version} | ||
- name: Determine Git SHA of workflow | ||
id: get-sha | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
workflow="${{ inputs.workflow_id }}" | ||
sha="$(gh run view ${workflow} --json headSha -t '{{.headSha}}')" | ||
echo "git-sha=$sha" >> $GITHUB_OUTPUT | ||
- name: Output Git SHA | ||
run: | | ||
echo ::notice title=Git SHA::${{ steps.get-sha.outputs.git-sha }} | ||
# Store the install script from the packaging repository as a release | ||
# artifact. | ||
install-script: | ||
name: Store install script | ||
runs-on: ubuntu-latest | ||
needs: | ||
- get-version | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ needs.get-version.outputs.git-sha }} | ||
|
||
- name: Store Linux install script as action artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: install.sh | ||
path: ./install-script/install.sh | ||
if-no-files-found: error | ||
|
||
- name: Store Windows install script as action artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: install.ps1 | ||
path: ./install-script/install.ps1 | ||
if-no-files-found: error | ||
|
||
create-release: | ||
name: Create Github release | ||
runs-on: ubuntu-20.04 | ||
needs: | ||
- get-version | ||
steps: | ||
- name: Download all artifacts from workflow | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: artifacts/ | ||
merge-multiple: true | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
run-id: ${{ inputs.workflow_id }} | ||
|
||
- uses: ncipollo/release-action@v1 | ||
with: | ||
name: v${{ needs.get-version.outputs.version }} | ||
commit: ${{ needs.get-version.outputs.git-sha }} | ||
tag: v${{ needs.get-version.outputs.version }} | ||
|
||
draft: true | ||
generateReleaseNotes: true | ||
prerelease: false | ||
|
||
allowUpdates: true | ||
omitBodyDuringUpdate: true | ||
omitNameDuringUpdate: true | ||
|
||
artifacts: "artifacts/*/*" | ||
artifactErrorsFailBuild: true | ||
replacesArtifacts: true | ||
|
||
body: | | ||
This release packages | ||
[${{ needs.get-version.outputs.version }}](https://github.com/SumoLogic/sumologic-otel-collector/releases/tag/v${{ needs.get-version.outputs.version }}). | ||
The changelog below is for the package itself, rather than the Sumo Logic Distribution for OpenTelemetry Collector. The | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
draft: true | ||
prerelease: false | ||
commit: ${{ needs.get-sha.outputs.git-sha }} | ||
tag: v${{ needs.get-version.outputs.version }} | ||
|
||
allowUpdates: true | ||
omitBodyDuringUpdate: true | ||
omitNameDuringUpdate: true | ||
|
||
body: | | ||
## v${{ needs.get-version.outputs.version }} | ||
**TODO** | ||
### Upstream releases | ||
** TODO: Add upstream versions in the links below** | ||
Core: https://github.com/open-telemetry/opentelemetry-collector/releases/tag/v | ||
Contrib: https://github.com/open-telemetry/opentelemetry-collector-contrib/releases/tag/v | ||
### Changelog | ||
**TODO** | ||
### Container images: | ||
``` | ||
docker pull public.ecr.aws/sumologic/sumologic-otel-collector:${{ needs.get-version.outputs.version }} | ||
``` | ||
artifacts: "artifacts/*" | ||
artifactErrorsFailBuild: true | ||
replacesArtifacts: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
# Releasing | ||
|
||
## How to release | ||
|
||
### Check end-to-end tests | ||
|
||
Check if the Sumo internal e2e tests are passing. | ||
|
||
### Determine the Workflow Run ID to release | ||
|
||
We can begin the process of creating a release once QE has given a thumbs up for | ||
a given package version and the [collector release steps][collector_release] | ||
have already been performed. We can determine the Workflow Run ID to use for a | ||
release using the following steps: | ||
|
||
#### Find the package build number | ||
|
||
Each package has a build number and it's included in the package version & | ||
filename. For example, if the package version that QE validates is 0.108.0-1790 | ||
then the build number is 1790. | ||
|
||
#### Find the collector workflow run | ||
|
||
We can find the workflow used to build the packages by using the package build | ||
number. | ||
|
||
The build number corresponds directly to the GitHub Run Number for a packaging | ||
workflow run in GitHub Actions. Unfortunately, there does not currently appear to | ||
be a way to reference a workflow run using the run number. Instead, we can use | ||
one of two methods to find the workflow run: | ||
|
||
#### Option 1 - Use the `gh` cli tool to find the workflow | ||
|
||
```shell | ||
PAGER="" | ||
BUILD_NUMBER="1790" | ||
gh run list -R sumologic/sumologic-otel-collector-packaging -s success \ | ||
-w build_packages.yml -L 200 -b main --json displayTitle,databaseId,number,url \ | ||
-q ".[] | select(.number == ${BUILD_NUMBER})" | ||
``` | ||
|
||
This will output a number of fields, for example: | ||
|
||
```json | ||
{ | ||
"databaseId": 11673248730, | ||
"displayTitle": "Build for Remote Workflow: 11672946742, Version: 0.108.0-sumo-1\n", | ||
"number": 1790, | ||
"url": "https://github.com/SumoLogic/sumologic-otel-collector-packaging/actions/runs/11673248730" | ||
} | ||
``` | ||
|
||
The number in the `databaseId` field is the ID for the workflow run that built | ||
the packages. | ||
|
||
The workflow run can be viewed by visiting the URL in the `url` field. | ||
|
||
#### Option 2 - Search the GitHub website manually | ||
|
||
Manually search for the run number on the | ||
[Build packages workflow][build_workflow] page. Search for the build number | ||
(e.g. 1790) until you find the corresponding workflow. | ||
|
||
![Finding the packaging workflow run][release_0] | ||
|
||
Once you've found the packaging workflow run, click it to navigate to the | ||
details of the workflow run. The Workflow Run ID can be found in the last part | ||
of the URL in the address bar: | ||
|
||
![Finding the packaging workflow ID][release_1] | ||
|
||
### Trigger the release | ||
|
||
Now that we have the Workflow Run ID we can trigger a release. There are two | ||
methods of doing this. | ||
|
||
#### Option 1 - Use the `gh` cli tool to trigger the release | ||
|
||
A release can be triggered by using the following command (be sure to replace | ||
`WORKFLOW_ID` with the Workflow Run ID from the previous step): | ||
|
||
```shell | ||
PAGER="" | ||
WORKFLOW_ID="11673248730" | ||
gh workflow run build_packages.yml \ | ||
-R sumologic/sumologic-otel-collector-packaging -f workflow_id=${WORKFLOW_ID} | ||
``` | ||
|
||
#### Option 2 - Use the GitHub website to trigger the release | ||
|
||
Navigate to the [Publish release][releases_workflow] workflow in GitHub Actions. | ||
Find and click the `Run workflow` button on the right-hand side of the page. | ||
Fill in the Workflow Run ID from the previous step. If the release should be | ||
considered to be the latest version, click the checkbox for `Latest version`. | ||
Click the `Run workflow` button to trigger the release. | ||
|
||
![Triggering a release][release_2] | ||
|
||
### Publish GitHub release | ||
|
||
The GitHub release is created as draft by the | ||
[releases](../.github/workflows/releases.yml) GitHub Action. | ||
|
||
After the release draft is created, go to [GitHub releases](https://github.com/SumoLogic/sumologic-otel-collector-packaging/releases), | ||
edit the release draft and fill in missing information: | ||
|
||
- Specify versions for upstream OT core and contrib releases | ||
- Copy and paste the Changelog entry for this release from [CHANGELOG.md][changelog] | ||
|
||
After verifying that the release text and all links are good, publish the release. | ||
|
||
[build_workflow]: https://github.com/SumoLogic/sumologic-otel-collector-packaging/actions/workflows/build_packages.yml?query=branch%3Amain | ||
[changelog]: https://github.com/SumoLogic/sumologic-otel-collector/blob/main/CHANGELOG.md | ||
[collector_release]: https://github.com/SumoLogic/sumologic-otel-collector/blob/main/docs/release.md | ||
[release_0]: ../images/release_0.png | ||
[release_1]: ../images/release_1.png | ||
[release_1]: ../images/release_2.png | ||
[releases_workflow]: https://github.com/SumoLogic/sumologic-otel-collector-packaging/actions/workflows/releases.yml |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.