-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'open-cluster-management-io:main' into main
- Loading branch information
Showing
24 changed files
with
560 additions
and
347 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,24 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: gomod | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
commit-message: | ||
prefix: ":seedling:" | ||
open-pull-requests-limit: 3 | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
commit-message: | ||
prefix: ":seedling:" | ||
groups: | ||
github-actions: | ||
patterns: | ||
- "*" | ||
# These actions directly influence the build process and are excluded from grouped updates | ||
exclude-patterns: | ||
- "actions/setup-go" | ||
- "arduino/setup-protoc" | ||
- "goreleaser/goreleaser-action" |
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,62 @@ | ||
name: ChartUpload | ||
|
||
permissions: | ||
contents: read | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
env: | ||
CHART_NAME: managed-serviceaccount | ||
|
||
jobs: | ||
env: | ||
name: prepare release env | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
- name: get release version | ||
id: get_release_version | ||
run: | | ||
RELEASE_VERSION=${GITHUB_REF#refs/tags/} | ||
echo "::set-output name=RELEASE_VERSION::${RELEASE_VERSION}" | ||
echo "::set-output name=MAJOR_RELEASE_VERSION::${RELEASE_VERSION%.*}" | ||
echo "::set-output name=TRIMMED_RELEASE_VERSION::${RELEASE_VERSION#v}" | ||
outputs: | ||
RELEASE_VERSION: ${{ steps.get_release_version.outputs.RELEASE_VERSION }} | ||
MAJOR_RELEASE_VERSION: ${{ steps.get_release_version.outputs.MAJOR_RELEASE_VERSION }} | ||
TRIMMED_RELEASE_VERSION: ${{ steps.get_release_version.outputs.TRIMMED_RELEASE_VERSION }} | ||
upload: | ||
name: upload | ||
runs-on: ubuntu-latest | ||
needs: [ env ] | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: submit charts to OCM chart repo | ||
if: github.event_name != 'pull_request' | ||
uses: actions/github-script@v7 | ||
with: | ||
github-token: ${{ secrets.OCM_BOT_PAT }} | ||
script: | | ||
try { | ||
const result = await github.rest.actions.createWorkflowDispatch({ | ||
owner: 'open-cluster-management-io', | ||
repo: 'helm-charts', | ||
workflow_id: 'download-chart.yml', | ||
ref: 'main', | ||
inputs: { | ||
repo: "${{ github.repository }}", | ||
version: "${{ needs.env.outputs.TRIMMED_RELEASE_VERSION }}", | ||
"chart-name": "${{ env.CHART_NAME }}", | ||
}, | ||
}) | ||
console.log(result); | ||
} catch(error) { | ||
console.error(error); | ||
core.setFailed(error); | ||
} |
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 |
---|---|---|
|
@@ -9,7 +9,7 @@ on: | |
|
||
env: | ||
# Common versions | ||
GO_VERSION: '1.21' | ||
GO_VERSION: '1.22' | ||
GO_REQUIRED_MIN_VERSION: '' | ||
GOPATH: '/home/runner/work/managed-serviceaccount/managed-serviceaccount/go' | ||
|
||
|
@@ -31,13 +31,13 @@ jobs: | |
fetch-depth: 1 | ||
path: go/src/open-cluster-management.io/managed-serviceaccount | ||
- name: install Go | ||
uses: actions/setup-go@v2 | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- name: install imagebuilder | ||
run: go install github.com/openshift/imagebuilder/cmd/[email protected] | ||
- name: pull base image | ||
run: docker pull registry.access.redhat.com/ubi8/ubi-minimal:latest --platform=linux/${{ matrix.arch }} | ||
run: docker pull registry.access.redhat.com/ubi9/ubi-minimal:latest --platform=linux/${{ matrix.arch }} | ||
- name: images | ||
run: | | ||
IMAGE_TAG=latest-${{ matrix.arch }} \ | ||
|
@@ -71,4 +71,4 @@ jobs: | |
quay.io/open-cluster-management/managed-serviceaccount:latest-arm64 --arch arm64 | ||
- name: push | ||
run: | | ||
docker manifest push quay.io/open-cluster-management/managed-serviceaccount:latest | ||
docker manifest push quay.io/open-cluster-management/managed-serviceaccount:latest |
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
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 |
---|---|---|
|
@@ -6,11 +6,10 @@ on: | |
- 'v*.*.*' | ||
env: | ||
# Common versions | ||
GO_VERSION: '1.21' | ||
GO_VERSION: '1.22' | ||
GO_REQUIRED_MIN_VERSION: '' | ||
GITHUB_REF: ${{ github.ref }} | ||
CHART_NAME: managed-serviceaccount | ||
CHART_VERSION_FILE_PATH: ./charts/managed-serviceaccount/Chart.yaml | ||
|
||
jobs: | ||
env: | ||
|
@@ -45,13 +44,13 @@ jobs: | |
with: | ||
fetch-depth: 1 | ||
- name: install Go | ||
uses: actions/setup-go@v2 | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- name: install imagebuilder | ||
run: go install github.com/openshift/imagebuilder/cmd/[email protected] | ||
- name: pull base image | ||
run: docker pull registry.access.redhat.com/ubi8/ubi-minimal:latest --platform=linux/${{ matrix.arch }} | ||
run: docker pull registry.access.redhat.com/ubi9/ubi-minimal:latest --platform=linux/${{ matrix.arch }} | ||
- name: images | ||
run: | | ||
IMAGE_TAG=${{ needs.env.outputs.RELEASE_VERSION }}-${{ matrix.arch }} \ | ||
|
@@ -95,7 +94,7 @@ jobs: | |
with: | ||
fetch-depth: 1 | ||
- name: setup helm | ||
uses: azure/setup-helm@v1 | ||
uses: azure/setup-helm@v4 | ||
- name: chart package | ||
run: | | ||
mkdir -p release | ||
|
@@ -106,7 +105,7 @@ jobs: | |
run: | | ||
echo "# Managed ServiceAccount ${{ needs.env.outputs.RELEASE_VERSION }}" > /home/runner/work/changelog.txt | ||
- name: publish release | ||
uses: softprops/action-gh-release@v1 | ||
uses: softprops/action-gh-release@v2 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
|
@@ -116,91 +115,3 @@ jobs: | |
draft: true | ||
prerelease: false | ||
generate_release_notes: true | ||
- name: submit charts to OCM chart repo | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.OCM_BOT_PAT }} | ||
script: | | ||
try { | ||
const result = await github.rest.actions.createWorkflowDispatch({ | ||
owner: 'open-cluster-management-io', | ||
repo: 'helm-charts', | ||
workflow_id: 'download-chart.yml', | ||
ref: 'main', | ||
inputs: { | ||
repo: "${{ github.repository }}", | ||
version: "${{ needs.env.outputs.TRIMMED_RELEASE_VERSION }}", | ||
"chart-name": "${{ env.CHART_NAME }}", | ||
}, | ||
}) | ||
console.log(result); | ||
} catch(error) { | ||
console.error(error); | ||
core.setFailed(error); | ||
} | ||
increase-chart-version: | ||
runs-on: ubuntu-latest | ||
needs: [ env, release ] | ||
steps: | ||
- name: checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: calculate next version | ||
id: calculate_next_version | ||
run: | | ||
echo "Current version: $CURRENT_VERSION" | ||
# Extract the major and minor version components | ||
MAJOR=$(echo $CURRENT_VERSION | cut -d '.' -f 1) | ||
MINOR=$(echo $CURRENT_VERSION | cut -d '.' -f 2) | ||
# Increment the minor version | ||
NEXT_MINOR=$((MINOR + 1)) | ||
# Construct the next version | ||
NEXT_VERSION="$MAJOR.$NEXT_MINOR.0" | ||
echo "next_version=$NEXT_VERSION" >> $GITHUB_OUTPUT | ||
env: | ||
CURRENT_VERSION: ${{ needs.env.outputs.TRIMMED_RELEASE_VERSION }} | ||
|
||
- name: update chart version file | ||
id: update_chart_version | ||
run: | | ||
echo "Updating chart version file from $CURRENT_VERSION to $NEXT_VERSION" | ||
sed -i "s/version: $CURRENT_VERSION/version: $NEXT_VERSION/" ${{ env.CHART_VERSION_FILE_PATH }} | ||
git diff | ||
FILE_CHANGED=$(git diff --exit-code --quiet && echo false || echo true) | ||
echo "Chart version file changed: $FILE_CHANGED" | ||
echo "file_changed=$FILE_CHANGED" >> $GITHUB_OUTPUT | ||
env: | ||
CURRENT_VERSION: ${{ needs.env.outputs.TRIMMED_RELEASE_VERSION }} | ||
NEXT_VERSION: ${{ steps.calculate_next_version.outputs.next_version }} | ||
|
||
- name: check if pull request already exists | ||
id: check_pull_request | ||
if : steps.update_chart_version.outputs.file_changed == 'true' | ||
run: | | ||
gh pr list --state open > pr_list.txt | ||
cat pr_list.txt | ||
PR_EXIST=$(grep -q "Update chart version to ${{ steps.calculate_next_version.outputs.next_version }}" pr_list.txt && echo true || echo false) | ||
echo "pr_exists=$PR_EXIST" >> $GITHUB_OUTPUT | ||
echo "Pull request for version ${{ steps.calculate_next_version.outputs.next_version }} exists: $PR_EXIST" | ||
rm -rf pr_list.txt | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: create pull request | ||
if: steps.update_chart_version.outputs.file_changed == 'true' && steps.check_pull_request.outputs.pr_exists != 'true' | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
# use OCM bot token to bypass "GitHub Actions is not permitted to create or approve pull requests." | ||
token: ${{ secrets.OCM_BOT_PAT }} | ||
commit-message: | | ||
Update chart version to ${{ steps.calculate_next_version.outputs.next_version }} | ||
title: ":seedling: Update chart version to ${{ steps.calculate_next_version.outputs.next_version }}" | ||
body: "Automatically updating chart version to ${{ steps.calculate_next_version.outputs.next_version }}" | ||
branch: update-chart-version-${{ steps.calculate_next_version.outputs.next_version }} | ||
signoff: true | ||
base: main | ||
env: | ||
CURRENT_VERSION: ${{ needs.env.outputs.TRIMMED_RELEASE_VERSION }} | ||
NEXT_VERSION: ${{ steps.calculate_next_version.outputs.next_version }} |
Oops, something went wrong.