chore(deps): update redis docker digest to b0efb06 #722
This file contains hidden or 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
name: Continuous Integration | |
concurrency: | |
# For pushes, this lets concurrent runs happen, so each push gets a result. | |
# But for other events (e.g. PRs), we can cancel the previous runs. | |
group: ${{ github.workflow }}-${{ github.event_name == 'push' && github.sha || github.ref }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
branches: [main] | |
push: | |
branches: [main] | |
permissions: | |
contents: read | |
jobs: | |
install-tools: | |
name: Install Tools | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- name: Set up Go | |
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 | |
with: | |
go-version-file: go.mod | |
cache: false | |
- name: Cache Go and Tools | |
id: cache | |
timeout-minutes: 5 | |
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 | |
with: | |
path: | | |
~/go/bin | |
~/go/pkg/mod | |
~/.cache/go-build | |
./.tools | |
key: go-cache-${{ runner.OS }}-${{ runner.ARCH }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
go-cache-${{ runner.OS }}-${{ runner.ARCH }}- | |
- name: Make install-tools | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: make install-tools | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
needs: install-tools | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- name: Set up Go | |
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 | |
with: | |
go-version-file: go.mod | |
cache: false | |
- name: Cache Go | |
timeout-minutes: 5 | |
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 | |
with: | |
path: | | |
~/go/bin | |
~/go/pkg/mod | |
~/.cache/go-build | |
./.tools | |
key: go-cache-${{ runner.OS }}-${{ runner.ARCH }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
go-cache-${{ runner.OS }}-${{ runner.ARCH }}- | |
fail-on-cache-miss: true | |
- name: Check packages are up-to-date | |
run: | | |
make tidy-all | |
git diff -s --exit-code || (echo 'Packages are out of date. Run make tidy-all and commit the changes' && git --no-pager diff && exit 1) | |
- name: Check Code Generation | |
run: | | |
make generate | |
git diff -s --exit-code || (echo 'Generated code is out of date. Run make generate and commit the changes' && git --no-pager diff && exit 1) | |
- name: Check crosslink run | |
run: | | |
make crosslink | |
git diff -s --exit-code || (echo 'Replace statements not updated. Run make crosslink and commit the changes' && git --no-pager diff && exit 1) | |
- name: Check formatting | |
run: | | |
make fmt-all | |
git diff -s --exit-code || (echo 'Code is not formatted. Run make fmt-all and commit the changes' && git --no-pager diff && exit 1) | |
- name: Check dependabot config | |
run: | | |
make gendependabot | |
git diff -s --exit-code || (echo 'Dependabot config is out of date. Run make gendependabot and commit the changes' && git --no-pager diff && exit 1) | |
- name: Make lint-all | |
run: make lint-all | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
needs: install-tools | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- name: Set up Go | |
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 | |
with: | |
go-version-file: go.mod | |
cache: false | |
- name: Cache Go | |
timeout-minutes: 5 | |
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 | |
with: | |
path: | | |
~/go/bin | |
~/go/pkg/mod | |
~/.cache/go-build | |
./.tools | |
key: go-cache-${{ runner.OS }}-${{ runner.ARCH }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
go-cache-${{ runner.OS }}-${{ runner.ARCH }}- | |
fail-on-cache-miss: true | |
- name: Make test-all | |
run: make test-all | |
build-and-push: | |
name: Build & push | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
needs: | |
- lint | |
- test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- name: Push to GAR | |
uses: grafana/shared-workflows/actions/push-to-gar-docker@751820b271417d91fe8588816ed4296b311caa33 # v0.5.1 | |
with: | |
# Only push to GAR on main branch pushes | |
push: ${{ github.event_name == 'push' && github.ref_name == 'main' }} | |
tags: |- | |
${{ github.sha }} | |
"latest" | |
context: "." | |
image_name: "grafana-ci-otel-collector" | |
environment: "dev" | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'push' && github.ref_name == 'main' }} | |
permissions: | |
id-token: write | |
contents: read | |
needs: | |
- lint | |
- test | |
- build-and-push | |
steps: | |
- id: find-commit-pr | |
uses: octokit/graphql-action@8ad880e4d437783ea2ab17010324de1075228110 # v2.3.2 | |
name: Find PR for commit | |
with: | |
query: | | |
query associatedPRs($sha: String, $repo: String!, $owner: String!) { | |
repository(name: $repo, owner: $owner) { | |
object(expression: $sha) { | |
... on Commit { | |
associatedPullRequests(first: 5) { | |
edges { | |
node { | |
number | |
commits(first: 1) { | |
edges { | |
node { | |
commit { | |
committedDate | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
variables: | | |
owner: ${{ github.repository_owner }} | |
repo: ${{ github.event.repository.name }} | |
sha: ${{ github.sha }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- id: extract-pr-number | |
name: Extract PR number | |
env: | |
PR: ${{ fromjson(steps.find-commit-pr.outputs.data).repository.object.associatedPullRequests.edges[0].node.number }} | |
FIRST_COMMIT_TS: ${{ fromjson(steps.find-commit-pr.outputs.data).repository.object.associatedPullRequests.edges[0].node.commits.edges[0].node.commit.committedDate }} | |
REPOSITORY_OWNER: ${{ github.repository_owner }} | |
REPOSITORY_NAME: ${{ github.event.repository.name }} | |
run: | | |
if [ -z "${PR}" ]; then | |
echo "No PR found, skipping..." | |
echo "contextMessage=\"\"" >> "${GITHUB_OUTPUT}" | |
exit 0 | |
fi | |
echo "This commit was from PR ${PR}" | |
echo "contextMessage= This deployment was triggered by [this pull request](https://github.com/${REPOSITORY_OWNER}/${REPOSITORY_NAME}/pull/${PR})." >> "${GITHUB_OUTPUT}" | |
echo "number=${PR}" >> "${GITHUB_OUTPUT}" | |
TS=$(date -u --date ${FIRST_COMMIT_TS} +'%s') | |
echo "first-commit-ts=${TS}" >> "${GITHUB_OUTPUT}" | |
cat "${GITHUB_OUTPUT}" | |
- id: submit-argowfs-deployment | |
if: ${{ github.event_name == 'push' && github.ref_name == 'main' && true || false }} | |
name: Submit Argo Workflows deployment | |
uses: grafana/shared-workflows/actions/trigger-argo-workflow@ecdca383418cd7662e5e96f6297c72c98d52916f # v1.1.1 | |
with: | |
namespace: release-cd | |
workflow_template: cicd-o11y | |
parameters: | | |
dockertag=${{ github.sha }} | |
prCommentContext=${{ steps.extract-pr-number.outputs.contextMessage }} |