Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: [release-1.12.x] feat: make build artifacts bucket configurable #140

Merged
merged 1 commit into from
Mar 22, 2024
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
2 changes: 2 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ ignorePatterns:
- '**/coverage/.*'
- '*.json'
- '**/.direnv'
- .lintstagedrc.js
- commitlint.config.js

parser: '@typescript-eslint/parser'

Expand Down
118 changes: 118 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
---
name: Check PR
on:
pull_request: {}
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-

- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: List the state of node modules
continue-on-error: true
run: npm list

- run: npm install
- run: npm run lint
actions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-

- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: List the state of node modules
continue-on-error: true
run: npm list

- run: npm install
- run: npm run actions
- run: |
git diff --name-only -- "actions/**/*.js" | xargs --no-run-if-empty git diff --exit-code -- \
|| (echo "Change to actions detected, please run 'npm run actions' and commit the changes" && false)
workflows:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- uses: kobtea/setup-jsonnet-action@v1
- run: npm run workflows
- run: |
git diff --name-only - w -- ".github/workflows/*.yml" | xargs --no-run-if-empty git diff -w --exit-code -- \
|| (echo "Change to workflows detected, please run 'npm run workflows' and commit the changes" && false)
test:
runs-on: ubuntu-latest
needs:
- lint
- actions
- workflows
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-

- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: List the state of node modules
continue-on-error: true
run: npm list

- run: npm install
- run: npm run ci-test
check-title:
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13 changes: 8 additions & 5 deletions .github/workflows/release-pr.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
concurrency:
group: "create-release-pr-${{ github.sha }}"
env:
BUILD_ARTIFACTS_BUCKET: "loki-build-artifacts"
BUILD_TIMEOUT: 25
CHANGELOG_PATH: "CHANGELOG.md"
DOCKER_USERNAME: "grafana"
DRY_RUN: false
IMAGE_PREFIX: "trevorwhitney075"
RELEASE_LIB_REF: "release-1.12.x"
RELEASE_REPO: "grafana/loki-release"
Expand Down Expand Up @@ -73,14 +75,15 @@ jobs:
--group-pull-request-title-pattern "chore\${scope}: release\${component} \${version}" \
--label "backport main,autorelease: pending,product-approved" \
--manifest-file .release-please-manifest.json \
--pull-request-footer "Merging this PR will release the [artifacts](https://console.cloud.google.com/storage/browser/loki-build-artifacts/${SHA}) of ${SHA}" \
--pull-request-footer "Merging this PR will release the [artifacts](https://console.cloud.google.com/storage/browser/${BUILD_ARTIFACTS_BUCKET}/${SHA}) of ${SHA}" \
--pull-request-title-pattern "chore\${scope}: release\${component} \${version}" \
--release-type simple \
--repo-url "${{ env.RELEASE_REPO }}" \
--separate-pull-requests false \
--target-branch "${{ steps.extract_branch.outputs.branch }}" \
--token "${{ steps.github_app_token.outputs.token }}" \
--versioning-strategy "${{ env.VERSIONING_STRATEGY }}"
--versioning-strategy "${{ env.VERSIONING_STRATEGY }}" \
--dry-run ${{ fromJSON(env.DRY_RUN) }}

working-directory: "lib"
dist:
Expand Down Expand Up @@ -138,7 +141,7 @@ jobs:
name: "upload artifacts"
uses: "google-github-actions/upload-cloud-storage@v2"
with:
destination: "loki-build-artifacts/${{ github.sha }}"
destination: "${{ env.BUILD_ARTIFACTS_BUCKET }}/${{ github.sha }}"
path: "release/dist"
process_gcloudignore: false
loki:
Expand Down Expand Up @@ -195,7 +198,7 @@ jobs:
name: "upload artifacts"
uses: "google-github-actions/upload-cloud-storage@v2"
with:
destination: "loki-build-artifacts/${{ github.sha }}/images"
destination: "${{ env.BUILD_ARTIFACTS_BUCKET }}/${{ github.sha }}/images"
path: "release/images/fake-loki-${{ needs.version.outputs.version}}-${{ steps.platform.outputs.platform }}.tar"
process_gcloudignore: false
strategy:
Expand Down Expand Up @@ -284,7 +287,7 @@ jobs:
echo "pr_created=true" >> $GITHUB_OUTPUT
fi
working-directory: "lib"
name: "create release PR"
name: "Create Release PR"
"on":
push:
branches:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
concurrency:
group: "create-release-${{ github.sha }}"
env:
BUILD_ARTIFACTS_BUCKET: "loki-build-artifacts"
IMAGE_PREFIX: "trevorwhitney075"
PUBLISH_TO_GCS: false
RELEASE_LIB_REF: "release-1.12.x"
Expand Down Expand Up @@ -61,7 +62,7 @@ jobs:
- name: "download binaries"
run: |
echo "downloading binaries to $(pwd)/dist"
gsutil cp -r gs://loki-build-artifacts/${{ needs.shouldRelease.outputs.sha }}/dist .
gsutil cp -r gs://${BUILD_ARTIFACTS_BUCKET}/${{ needs.shouldRelease.outputs.sha }}/dist .
working-directory: "release"
- env:
GH_TOKEN: "${{ steps.github_app_token.outputs.token }}"
Expand Down Expand Up @@ -208,8 +209,9 @@ jobs:
uses: "./lib/actions/should-release"
with:
baseBranch: "${{ steps.extract_branch.outputs.branch }}"
name: "create release"
name: "Create Release"
"on":
pull_request: {}
push:
branches:
- "release-[0-9]+.[0-9]+.x"
Expand Down
Loading
Loading