Skip to content

Commit

Permalink
Add job for bumping dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
bgandon committed Feb 2, 2024
1 parent 0847e14 commit bcfc20c
Show file tree
Hide file tree
Showing 2 changed files with 138 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ci/release_notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Improvements

- Added job in pipeline for bumping dependencies
- Built with latest Go v1.21.6
134 changes: 134 additions & 0 deletions ci/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ meta:
icon: ((slack-icon-url))
channel: "#oss-pipelines-notifications"

groups:
- name: bump
jobs:
- bump-deps

jobs:

- name: test
Expand All @@ -55,6 +60,7 @@ jobs:
- (( merge on get ))
- get: golang-alpine
trigger: true
passed: [ bump-deps ]

# NOTICE: we replace all further steps
- # task: test
Expand Down Expand Up @@ -103,6 +109,7 @@ jobs:
- (( merge on get ))
- get: golang-alpine
trigger: true
passed: [ bump-deps ]

- {} # put: git-pull-requests

Expand Down Expand Up @@ -134,6 +141,115 @@ jobs:
params:
SHIPIT_SCRIPT: (( concat "./gopath/src/" meta.go.module "/ci/scripts/shipit" ))

- name: bump-deps
public: true
serial: true
plan:
- in_parallel:
- { get: weekly, trigger: true }
- { get: git }
- { get: gk-automation }
- { get: golang-alpine }
- { get: image }

- task: bump-golang-deps
image: golang-alpine
config:
platform: linux
inputs: [ { name: git, path: repo } ]
outputs:
- name: repo-bumped
- name: golang-info
run:
path: sh
args:
- -ec
- |
find "repo" -mindepth 1 -maxdepth 1 -print0 \
| xargs -0 -I{} cp -a {} "repo-bumped"
cd "repo-bumped" || exit 115
awk '/^go /{print $2}' go.mod > ../golang-info/previous-version
(
set -x
go_version=$(
go version \
| awk '{sub(/go/,"",$3); sub(/\.[[:digit:]]+$/,"",$3); print $3}'
)
sed -i -Ee "s/^go [[:digit:].]+\$/go ${go_version}/" go.mod
go get -t -u ./...
go mod tidy
echo "${go_version}" > ../golang-info/version
)
- <<: *compile_task
input_mapping: { git: repo-bumped }

- *smpoke_test_task

- task: generate-messages
image: image
config:
platform: linux
inputs: [ name: golang-info ]
outputs: [ name: messages ]
run:
path: bash
args:
- -c
- |
set -ueo pipefail
go_prev_ver=$(< golang-info/previous-version)
go_curr_ver=$(< golang-info/version)
version_details="${go_curr_ver}"
if [[ ${go_curr_ver} != ${go_prev_ver} ]]; then
version_details="from ${go_prev_ver} to ${go_curr_ver} and its"
fi
echo "Update Golang ${version_details} dependencies" \
> messages/commit-message
echo "${PIPELINE_NAME}: successfully bumped Golang ${version_details} dependencies," \
"with passing tests! :tada:" \
"<${PIPELINE_URL}|Ship it when ready!> ${SUCCESS_MOJI}" \
> messages/notif-body
params:
SUCCESS_MOJI: (( grab meta.slack.success_moji ))
PIPELINE_URL: (( grab meta.slack.pipeline_url ))
PIPELINE_NAME: (( grab meta.pipeline ))

- task: git-commit
image: image
file: gk-automation/tasks/git/commit.yml
input_mapping:
repo: repo-bumped
commit-info: messages
params:
GIT_COMMIT_NAME: (( grab meta.git.name ))
GIT_COMMIT_EMAIL: (( grab meta.git.email ))
GIT_DIFF_OPTS: --color-words

- put: git
params:
repository: repo-committed
rebase: true

on_failure:
put: notify
params:
channel: (( grab meta.slack.channel ))
username: (( grab meta.slack.username ))
icon_url: (( grab meta.slack.icon ))
text: (( grab meta.slack.fail_text ))
on_success:
put: notify
params:
channel: (( grab meta.slack.channel ))
username: (( grab meta.slack.username ))
icon_url: (( grab meta.slack.icon ))
text_file: messages/notif-body

resources:

- name: image
Expand Down Expand Up @@ -170,3 +286,21 @@ resources:
- name: git-pull-requests
webhook_token: ((concourse-webhook-token))
# check_every: 1m # we leave the default here

- name: weekly
type: time
icon: alarm
source:
location: Europe/Paris
start: "3:00"
stop: "4:30"
days: [ Saturday ]

- name: gk-automation
type: git
icon: github
check_every: 24h
source:
uri: [email protected]:gstackio/gk-automation.git
branch: master
private_key: (( grab meta.github.private_key ))

0 comments on commit bcfc20c

Please sign in to comment.