Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ISIS3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
aflab
astrogeology
ISIS3
Commits
8e8ef4dd
Unverified
Commit
8e8ef4dd
authored
4 months ago
by
Christine Kim
Committed by
GitHub
4 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Update LTS Pipeline (#5714)
* Add lts workflow * Set versions to 9.0
parent
3aa6d786
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
.github/pr_label_checker.py
+8
-12
8 additions, 12 deletions
.github/pr_label_checker.py
.github/workflows/gitlab-lts.yml
+28
-25
28 additions, 25 deletions
.github/workflows/gitlab-lts.yml
with
36 additions
and
37 deletions
.github/pr_label_checker.py
+
8
−
12
View file @
8e8ef4dd
...
@@ -42,7 +42,7 @@ def get_pr_attributes(response: Response) -> tuple:
...
@@ -42,7 +42,7 @@ def get_pr_attributes(response: Response) -> tuple:
Get necessary PR attributes.
Get necessary PR attributes.
"""
"""
pull_response_json
=
response
.
json
()
pull_response_json
=
response
.
json
()
if
len
(
pull_response_json
)
==
0
:
if
not
pull_response_json
:
# No PRs attributed to the commit
# No PRs attributed to the commit
print
(
False
)
print
(
False
)
sys
.
exit
(
0
)
sys
.
exit
(
0
)
...
@@ -64,6 +64,7 @@ def search_for_linked_issues(pull_body: str) -> list:
...
@@ -64,6 +64,7 @@ def search_for_linked_issues(pull_body: str) -> list:
# Split the PR body by heading
# Split the PR body by heading
pull_body_list
=
pull_body
.
split
(
'
##
'
)
pull_body_list
=
pull_body
.
split
(
'
##
'
)
regex_pattern
=
rf
'
{
ISSUES_URL
}
(\d)|(#[^\D]\d*)
'
regex_pattern
=
rf
'
{
ISSUES_URL
}
(\d)|(#[^\D]\d*)
'
issue_numbers
=
[]
for
section
in
pull_body_list
:
for
section
in
pull_body_list
:
# Find section with heading 'Related Issue'
# Find section with heading 'Related Issue'
if
section
!=
None
and
'
Related Issue
'
in
section
:
if
section
!=
None
and
'
Related Issue
'
in
section
:
...
@@ -76,9 +77,6 @@ def search_for_linked_issues(pull_body: str) -> list:
...
@@ -76,9 +77,6 @@ def search_for_linked_issues(pull_body: str) -> list:
# Remove '#' from items
# Remove '#' from items
issue_numbers
=
list
(
map
(
lambda
item
:
item
.
replace
(
'
#
'
,
''
),
filtered_list
))
issue_numbers
=
list
(
map
(
lambda
item
:
item
.
replace
(
'
#
'
,
''
),
filtered_list
))
return
issue_numbers
return
issue_numbers
# No linked issues
print
(
False
)
sys
.
exit
(
0
)
def
get_linked_issues
(
issue_numbers
:
list
)
->
list
:
def
get_linked_issues
(
issue_numbers
:
list
)
->
list
:
...
@@ -113,10 +111,6 @@ def get_issue_labels(response_list: list) -> list:
...
@@ -113,10 +111,6 @@ def get_issue_labels(response_list: list) -> list:
if
label_name
not
in
combined_issue_labels
:
if
label_name
not
in
combined_issue_labels
:
# Add label if it does not exist
# Add label if it does not exist
combined_issue_labels
.
append
(
label_name
)
combined_issue_labels
.
append
(
label_name
)
if
not
combined_issue_labels
:
# No labels to return
print
(
False
)
sys
.
exit
(
0
)
return
combined_issue_labels
return
combined_issue_labels
def
update_pr_labels
(
pull_number
:
str
,
combined_issue_labels
:
list
):
def
update_pr_labels
(
pull_number
:
str
,
combined_issue_labels
:
list
):
...
@@ -163,8 +157,10 @@ if __name__ == "__main__":
...
@@ -163,8 +157,10 @@ if __name__ == "__main__":
response
=
get_prs_associated_with_commit
()
response
=
get_prs_associated_with_commit
()
pull_number
,
pull_body
=
get_pr_attributes
(
response
)
pull_number
,
pull_body
=
get_pr_attributes
(
response
)
issue_numbers
=
search_for_linked_issues
(
pull_body
)
issue_numbers
=
search_for_linked_issues
(
pull_body
)
if
issue_numbers
:
response_list
=
get_linked_issues
(
issue_numbers
)
response_list
=
get_linked_issues
(
issue_numbers
)
combined_issue_labels
=
get_issue_labels
(
response_list
)
combined_issue_labels
=
get_issue_labels
(
response_list
)
if
combined_issue_labels
:
update_pr_labels
(
pull_number
,
combined_issue_labels
)
update_pr_labels
(
pull_number
,
combined_issue_labels
)
# Check if PR is a bugfix
# Check if PR is a bugfix
...
...
This diff is collapsed.
Click to expand it.
.github/workflows/
autopr_bugfix
.yml
→
.github/workflows/
gitlab-lts
.yml
+
28
−
25
View file @
8e8ef4dd
name
:
Cherrypick bugfixes to release branch
name
:
Github to Gitlab CI - Run CodeBuild (LTS)
env
:
GITLAB_TOKEN
:
${{ secrets.GITLAB_TOKEN }}
ANACONDA_TOKEN
:
${{ secrets.ANACONDA_TOKEN }}
on
:
on
:
push
:
push
:
branches
:
branches
:
...
@@ -37,32 +42,30 @@ jobs:
...
@@ -37,32 +42,30 @@ jobs:
# Print the result to the log
# Print the result to the log
-
name
:
See result
-
name
:
See result
run
:
echo "${{ steps.execute_py_script.outputs.result }}"
run
:
echo "${{ steps.execute_py_script.outputs.result }}"
release_pull_request
:
build
:
needs
:
check_labels
needs
:
check_labels
# Only run this step if the code was a bugfix
# Only run this step if the code was a bugfix
if
:
contains(needs.check_labels.outputs.result, 'true')
if
:
contains(needs.check_labels.outputs.result, 'true')
runs-on
:
ubuntu-latest
runs-on
:
ubuntu-latest
name
:
release_pull_request
steps
:
steps
:
-
name
:
checkout
-
uses
:
actions/checkout@v4
uses
:
actions/checkout@v2.2.0
-
name
:
Run script
# Fetch all info including branches + tags
with
:
fetch-depth
:
0
-
name
:
'
Get
Previous
tag'
id
:
get_latest_tag
uses
:
"
WyriHaximus/github-action-get-previous-tag@v1"
-
id
:
get_short_version
# Get the major / minor version without patch info i.e. 6.0 from 6.0.1
run
:
|
major_minor=$(echo ${{steps.get_latest_tag.outputs.tag}} | cut -d '.' -f 1,2)
echo "::set-output name=major_minor::$major_minor"
-
name
:
Create PR to branch
uses
:
adamtharani/github-action-cherry-pick@master
# PR to the latest feature release. Merges are enabled
with
:
pr_branch
:
${{steps.get_short_version.outputs.major_minor}}
env
:
env
:
GITHUB_TOKEN
:
${{ secrets.GITHUB_TOKEN }}
LTS_VERSION
:
9.0.0_LTS
# formatted as x.x.x_LTS
DRY_RUN
:
false
BASE_LTS
:
9.0
GITHUB_SHA
:
${{ secrets.GITHUB_SHA }}
run
:
|
git config --global user.name "Github_CI"
git config --global user.email "project_14468_bot_3f7d8e1a392afd88ead5f3f3154e809d@noreply.gitlab.com"
git clone https://isis-codebuild-ci:$GITLAB_TOKEN@code.usgs.gov/astrogeology/isis-codebuild-ci.git
echo $LTS_VERSION
cd isis-codebuild-ci
if [[ "git ls-remote --exit-code origin $LTS_VERSION" == 2 ]]; then
git checkout -b $LTS_VERSION
else
git checkout $LTS_VERSION
git reset --hard origin/main
fi
echo -e "\nenv: \n shell: bash \n variables: \n LTS_VERSION: $LTS_VERSION \n BASE_LTS: $BASE_LTS \n ANACONDA_API_TOKEN: $ANACONDA_TOKEN \n GITHUB_SHA: $GITHUB_SHA" >> buildspec-lts.yml
git commit -a -m "$LTS_VERSION"
git push origin $LTS_VERSION --force
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment