Skip to content
Merged
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
106 changes: 67 additions & 39 deletions .github/workflows/release-layer-collector.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: "Release Collector Lambda layer"

on:
# (Using tag push instead of release to allow filtering by tag prefix.)
push:
tags:
- layer-collector/**
branches:
- main

permissions:
id-token: write
Expand All @@ -13,10 +12,38 @@ permissions:
jobs:
create-release:
runs-on: ubuntu-latest
outputs:
NEW_TAG: ${{ steps.increment_tag.outputs.NEW_TAG }}
steps:
- uses: actions/checkout@v4
with:
fetch-tags: true
fetch-depth: 0
- name: Get the last tag
id: get_last_tag
run: |
cd ${{ github.workspace }}
pwd
last_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "::set-output name=last_tag::$last_tag"
# The following 15 lines of code were human modified suggestions given by GitHub Copilot
- name: Increment tag version
id: increment_tag
run: |
last_tag=${{ steps.get_last_tag.outputs.last_tag }}
prefix=$(echo $last_tag | cut -d'/' -f1)
major=$(echo $last_tag | cut -d'/' -f2 | cut -d'.' -f1)
minor=$(echo $last_tag | cut -d'/' -f2 | cut -d'.' -f2)
patch=$(echo $last_tag | cut -d'.' -f3)
new_major=$((major + 1))
new_tag="$prefix/$new_major.0.0"
git tag $new_tag
git push origin $new_tag
echo "::set-output name=new_tag::$new_tag"
echo "NEW_TAG=$new_tag" >> $GITHUB_OUTPUT
NEW_TAG=$new_tag
- name: Create Release
run: gh release create ${{ github.ref_name }} --draft --title ${{ github.ref_name }}
run: gh release create ${{ steps.increment_tag.outputs.new_tag }} --title ${{ steps.increment_tag.outputs.new_tag }} --generate-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-layer:
Expand All @@ -35,14 +62,14 @@ jobs:
with:
go-version: '^1.23.1'
- name: build
run: make -C collector package GOARCH=${{ matrix.architecture }}
run: make -C collector package GOARCH=${{ matrix.architecture }} BUILDTAGS="lambdacomponents.custom,lambdacomponents.all"
- uses: actions/upload-artifact@v4
with:
name: opentelemetry-collector-layer-${{ matrix.architecture }}.zip
path: ${{ github.workspace }}/collector/build/opentelemetry-collector-layer-${{ matrix.architecture }}.zip
- name: Add Binary to Release
run: |
gh release upload ${{github.ref_name}} ${{ github.workspace }}/collector/build/opentelemetry-collector-layer-${{ matrix.architecture }}.zip
gh release upload ${{ needs.create-release.outputs.NEW_TAG }} ${{ github.workspace }}/collector/build/opentelemetry-collector-layer-${{ matrix.architecture }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Save Collector Version
Expand All @@ -54,36 +81,37 @@ jobs:
COLLECTOR_VERSION=$( ${{ github.workspace }}/collector/build/extensions/collector -v)
echo "COLLECTOR_VERSION=$COLLECTOR_VERSION" >> $GITHUB_OUTPUT

publish-layer:
uses: ./.github/workflows/layer-publish.yml
needs: build-layer
strategy:
matrix:
architecture:
- amd64
- arm64
aws_region:
- ap-northeast-1
- ap-northeast-2
- ap-south-1
- ap-southeast-1
- ap-southeast-2
- ca-central-1
- eu-central-1
- eu-north-1
- eu-west-1
- eu-west-2
- eu-west-3
- sa-east-1
- us-east-1
- us-east-2
- us-west-1
- us-west-2
with:
artifact-name: opentelemetry-collector-layer-${{ matrix.architecture }}.zip
layer-name: opentelemetry-collector
component-version: ${{needs.build-layer.outputs.COLLECTOR_VERSION}}
architecture: ${{ matrix.architecture }}
release-group: prod
aws_region: ${{ matrix.aws_region }}
secrets: inherit
# Commented out since we don't publish the layer to AWS now
# publish-layer:
# uses: ./.github/workflows/layer-publish.yml
# needs: build-layer
# strategy:
# matrix:
# architecture:
# - amd64
# - arm64
# aws_region:
# - ap-northeast-1
# - ap-northeast-2
# - ap-south-1
# - ap-southeast-1
# - ap-southeast-2
# - ca-central-1
# - eu-central-1
# - eu-north-1
# - eu-west-1
# - eu-west-2
# - eu-west-3
# - sa-east-1
# - us-east-1
# - us-east-2
# - us-west-1
# - us-west-2
# with:
# artifact-name: opentelemetry-collector-layer-${{ matrix.architecture }}.zip
# layer-name: opentelemetry-collector
# component-version: ${{needs.build-layer.outputs.COLLECTOR_VERSION}}
# architecture: ${{ matrix.architecture }}
# release-group: prod
# aws_region: ${{ matrix.aws_region }}
# secrets: inherit
27 changes: 27 additions & 0 deletions devops/DownloadLayer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
parameters:
- name: skipBuild
type: string
default: "false"
- name: githubConnection
type: string
default: "Sage"
- name: defaultVersionType
type: string
default: "latest"

jobs:
- job: DownloadOpenTelemetryLayer
displayName: "Download OpenTelemetry Layer"
condition: and(succeeded(), eq('${{ parameters.skipBuild }}', false))
steps:
- task: DownloadGitHubRelease@0
inputs:
connection: ${{ parameters.githubConnection }}
userRepository: Sage/opentelemetry-lambda
defaultVersionType: ${{ parameters.defaultVersionType }}
downloadPath: '$(System.ArtifactsDirectory)'
- task: PublishBuildArtifacts@1
displayName: "Publish to build output"
inputs:
artifactName: "build_output"
PathtoPublish: "$(System.ArtifactsDirectory)"
28 changes: 28 additions & 0 deletions pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!--- Provide a general summary of your changes in the Title above -->
<!--- Please delete options that are not relevant. -->

# Description
<!--- Describe your changes in detail. Please also include relevant motivation and context. -->

## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Refactor (code change that neither fixes a bug nor adds a feature)
- [ ] Hot fix (patch that fixes a bug in production)

## How has this been tested? (optional)
<!--- Please describe the tests that you ran (automated or manual) to verify your changes.-->
<!--- Provide instructions or any relevant details for your test configuration -->

## Screenshots (if appropriate):

## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [ ] My code follows the code style of this project.
- [ ] I have performed a self-review of my code
- [ ] I have added tests to cover my changes.
- [ ] I ran CI Tests and Unit tests locally prior to submission.
- [ ] I have updated the documentation accordingly to my changes.
Loading