diff --git a/.github/workflows/release-layer-collector.yml b/.github/workflows/release-layer-collector.yml index 32e64b6761..16c4355b93 100644 --- a/.github/workflows/release-layer-collector.yml +++ b/.github/workflows/release-layer-collector.yml @@ -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 @@ -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: @@ -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 @@ -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 diff --git a/devops/DownloadLayer.yml b/devops/DownloadLayer.yml new file mode 100644 index 0000000000..5a983a37cb --- /dev/null +++ b/devops/DownloadLayer.yml @@ -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)" diff --git a/pull_request_template.md b/pull_request_template.md new file mode 100644 index 0000000000..33a6a8c26c --- /dev/null +++ b/pull_request_template.md @@ -0,0 +1,28 @@ + + + +# Description + + +## Types of changes + +- [ ] 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) + + + +## Screenshots (if appropriate): + +## Checklist: + + +- [ ] 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. \ No newline at end of file