Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
03f5fd0c
Commit
03f5fd0c
authored
Oct 26, 2023
by
Tushar Shah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add awk script to ignore single and multi line comments & require only 1 match
parent
93f38e6d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
2 deletions
+27
-2
config.yml
.circleci/config.yml
+27
-2
No files found.
.circleci/config.yml
View file @
03f5fd0c
...
@@ -1240,16 +1240,40 @@ jobs:
...
@@ -1240,16 +1240,40 @@ jobs:
-
image
:
us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:latest
-
image
:
us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:latest
steps
:
steps
:
-
checkout
-
checkout
-
run
:
name
:
Filter comments and match only 1 script
command
:
|
SCRIPT=$(cat <<'EOF'
BEGIN { in_comment = 0; matches = 0; }
/^ *\/\*/ { in_comment = 1; }
in_comment && /\*\// { in_comment = 0; next; }
!in_comment && !/^ *\/\// && /PATTERN/ { matches++; matched_line = $0; }
END {
if (matches == 1) {
print matched_line;
} else if (matches > 1) {
print "Multiple matches found. Exiting.";
exit 1;
} else {
print "No matches found. Exiting.";
exit 1;
}
}
EOF
)
echo "export SCRIPT=$SCRIPT" >> $BASH_ENV
-
run
:
-
run
:
name
:
Extract value from file1
name
:
Extract value from file1
command
:
|
command
:
|
VALUE1=$(
grep '<< parameters.pattern_file1 >>'
<< parameters.file1_path >> | awk -F'=' '{print $2}' | tr -d ' ;')
VALUE1=$(
echo "$SCRIPT" | awk -v PATTERN='<< parameters.pattern_file1 >>' -f-
<< parameters.file1_path >> | awk -F'=' '{print $2}' | tr -d ' ;')
echo "export VALUE1=$VALUE1" >> $BASH_ENV
echo "export VALUE1=$VALUE1" >> $BASH_ENV
-
run
:
-
run
:
name
:
Extract value from file2
name
:
Extract value from file2
command
:
|
command
:
|
VALUE2=$(
grep '<< parameters.pattern_file2 >>'
<< parameters.file2_path >> | awk -F'=' '{print $2}' | tr -d ' ;')
VALUE2=$(
echo "$SCRIPT" | awk -v PATTERN='<< parameters.pattern_file2 >>' -f-
<< parameters.file2_path >> | awk -F'=' '{print $2}' | tr -d ' ;')
echo "export VALUE2=$VALUE2" >> $BASH_ENV
echo "export VALUE2=$VALUE2" >> $BASH_ENV
-
run
:
-
run
:
name
:
Compare values
name
:
Compare values
command
:
|
command
:
|
...
@@ -1260,6 +1284,7 @@ jobs:
...
@@ -1260,6 +1284,7 @@ jobs:
echo "Values match!"
echo "Values match!"
fi
fi
workflows
:
workflows
:
main
:
main
:
when
:
when
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment