Skip to content

Commit e3b88e3

Browse files
Merge remote-tracking branch 'origin/main' into cx-hide-dev-dep-AST-105457
2 parents 59c1901 + 06641ec commit e3b88e3

File tree

3 files changed

+35
-11
lines changed

3 files changed

+35
-11
lines changed

.github/workflows/release.yml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,29 @@ jobs:
5151
chmod +x ./.github/scripts/update_cli.sh
5252
./.github/scripts/update_cli.sh ${{ inputs.cliTag }}
5353
54+
- name: Extract CLI version
55+
id: extract_cli_version
56+
run: |
57+
CLI_VERSION=$(./src/main/resources/cx-linux version | grep -Eo '^[0-9]+\.[0-9]+\.[0-9]+')
58+
echo "CLI version being packed is $CLI_VERSION"
59+
echo "CLI_VERSION=$CLI_VERSION" >> $GITHUB_ENV
60+
echo "::set-output name=CLI_VERSION::$CLI_VERSION"
61+
62+
- name: Check if CLI version is latest
63+
if: ${{ github.event.inputs.dev == 'false' && !github.event.inputs.cliTag && github.ref == 'refs/heads/main' }}
64+
id: check_latest_cli_version
65+
run: |
66+
LATEST_CLI_VERSION=$(curl -s https://api.github.com/repos/Checkmarx/ast-cli/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
67+
echo "CLI_VERSION=[$CLI_VERSION]"
68+
echo "LATEST_CLI_VERSION=[$LATEST_CLI_VERSION]"
69+
echo "Latest CLI version from GitHub: $LATEST_CLI_VERSION"
70+
if [ "$CLI_VERSION" = "$LATEST_CLI_VERSION" ]; then
71+
echo "CLI_VERSION ($CLI_VERSION) matches the latest released version ($LATEST_CLI_VERSION). Proceeding."
72+
else
73+
echo "CLI_VERSION ($CLI_VERSION) does not match the latest released version ($LATEST_CLI_VERSION). Failing workflow."
74+
exit 1
75+
fi
76+
5477
- name: Tag
5578
id: set_tag_name
5679
run: |
@@ -94,14 +117,6 @@ jobs:
94117
fi
95118
echo "AID_PROP=${prop}" >> $GITHUB_ENV
96119
97-
- name: Extract CLI version
98-
id: extract_cli_version
99-
run: |
100-
CLI_VERSION=$(./src/main/resources/cx-linux version | grep -Eo '^[0-9]+\.[0-9]+\.[0-9]+')
101-
echo "CLI version being packed is $CLI_VERSION"
102-
echo "CLI_VERSION=$CLI_VERSION" >> $GITHUB_ENV
103-
echo "::set-output name=CLI_VERSION::$CLI_VERSION"
104-
105120
- name: Publish package
106121
run: mvn --batch-mode deploy -DskipTests ${{ env.AID_PROP }}
107122
env:

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<dependency>
2525
<groupId>org.apache.commons</groupId>
2626
<artifactId>commons-lang3</artifactId>
27-
<version>3.18.0</version>
27+
<version>3.14.0</version>
2828
</dependency>
2929
<dependency>
3030
<groupId>com.googlecode.json-simple</groupId>
@@ -44,7 +44,7 @@
4444
<dependency>
4545
<groupId>com.google.code.gson</groupId>
4646
<artifactId>gson</artifactId>
47-
<version>2.12.0</version>
47+
<version>2.10.1</version>
4848
</dependency>
4949
<dependency>
5050
<groupId>org.slf4j</groupId>

src/main/java/com/checkmarx/ast/wrapper/CxConfig.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import lombok.Data;
66
import lombok.Setter;
77
import org.apache.commons.lang3.StringUtils;
8+
89
import java.util.ArrayList;
910
import java.util.List;
1011
import java.util.regex.Matcher;
@@ -33,7 +34,15 @@ public void setAdditionalParameters(String additionalParameters) {
3334
List<String> toArguments() {
3435
List<String> commands = new ArrayList<>();
3536

36-
if (StringUtils.isNotBlank(getApiKey())) {
37+
if (StringUtils.isNotBlank(getClientId()) && StringUtils.isNotBlank(getApiKey())) {
38+
/*
39+
* Added dynamic client-id support for refresh_token grant flow
40+
*/
41+
commands.add(CxConstants.CLIENT_ID);
42+
commands.add(getClientId());
43+
commands.add(CxConstants.API_KEY);
44+
commands.add(getApiKey());
45+
} else if (StringUtils.isNotBlank(getApiKey())) {
3746
commands.add(CxConstants.API_KEY);
3847
commands.add(getApiKey());
3948
} else if (StringUtils.isNotBlank(getClientId()) && StringUtils.isNotBlank(getClientSecret())) {

0 commit comments

Comments
 (0)