Skip to content

Commit

Permalink
Order flags alphabetically and update 2.0 release notes (#240)
Browse files Browse the repository at this point in the history
* Order flags alphabetically and update 2.0 release notes

* Use Debian unstable instead of testing for more stable packages

* Add rolling fingerprint release to a and b repositories

---------

Co-authored-by: Oscar Reimer <[email protected]>
  • Loading branch information
filip-debricked and sweoggy authored Jun 12, 2024
1 parent b58a4f1 commit bf1f53a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 39 deletions.
2 changes: 1 addition & 1 deletion UPGRADE-2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Changed behaviours
- Changes default strictness of resolve command to 1 (Exit with code 1 if all files failed to resolve, otherwise exit with code 0 instead of always exiting with code 0)
- File Fingerprint analysis is on by default, rolling roll-out starting with all repositories that start with the letter "C".
- File Fingerprint analysis is on by default for all repositories which starts with the letters "A-C". This range will be increased in future minor/patch releases.
- Added inclusion option to commands to force include patterns which are by default ignored by the CLI
- Refactored how exclusion works for fingerprinting to align it with the rest of the CLI, this includes a breaking change for windows where Unix path separators must be used in patterns.

Expand Down
23 changes: 15 additions & 8 deletions build/docker/debian.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ FROM cli AS scan
CMD [ "debricked", "scan" ]

FROM cli-base AS resolution

RUN echo "deb http://deb.debian.org/debian unstable main" >> /etc/apt/sources.list && \
echo "Package: *" >> /etc/apt/preferences && \
echo "Pin: release a=unstable" >> /etc/apt/preferences && \
echo "Pin-Priority: -2" >> /etc/apt/preferences

# Uncomment below if testing packages are needed
#RUN echo "deb http://deb.debian.org/debian testing-updates main" >> /etc/apt/sources.list && \
# echo "deb http://deb.debian.org/debian testing main" >> /etc/apt/sources.list && \
# echo "Package: *" >> /etc/apt/preferences && \
# echo "Pin: release a=testing" >> /etc/apt/preferences && \
# echo "Pin-Priority: -3" >> /etc/apt/preferences

RUN apt -y update && apt -y upgrade && apt -y install curl gnupg unzip && \
apt -y clean && rm -rf /var/lib/apt/lists/*

Expand Down Expand Up @@ -66,19 +79,13 @@ RUN ./dotnet-install.sh --channel $DOTNET_MAJOR --install-dir $DOTNET_ROOT
RUN rm ./dotnet-install.sh
ENV PATH $DOTNET_ROOT:$PATH

RUN echo "deb http://ftp.us.debian.org/debian testing-updates main" >> /etc/apt/sources.list && \
echo "deb http://ftp.us.debian.org/debian testing main" >> /etc/apt/sources.list && \
echo "Package: *" >> /etc/apt/preferences && \
echo "Pin: release a=testing" >> /etc/apt/preferences && \
echo "Pin-Priority: -2" >> /etc/apt/preferences

ENV GOLANG_VERSION 1.22
RUN apt -y update && apt -y upgrade && apt -y install \
python3 \
python3-venv \
ca-certificates \
python3-pip && \
apt -y install -t testing \
apt -y install -t unstable \
golang-$GOLANG_VERSION \
openjdk-21-jre && \
apt -y clean && rm -rf /var/lib/apt/lists/* && \
Expand All @@ -91,7 +98,7 @@ RUN apt -y update && apt -y upgrade && apt -y install \
RUN dotnet --version

RUN apt update -y && \
apt install -t testing lsb-release apt-transport-https ca-certificates software-properties-common -y && \
apt install -t unstable lsb-release apt-transport-https ca-certificates software-properties-common -y && \
curl -o /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg && \
sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' && \
apt -y clean && rm -rf /var/lib/apt/lists/*
Expand Down
62 changes: 32 additions & 30 deletions internal/cmd/scan/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,48 @@ import (
"github.com/spf13/viper"
)

var repositoryName string
var commitName string
var branchName string
var callgraph bool
var callgraphGenerateTimeout int
var callgraphUploadTimeout int
var commitAuthor string
var repositoryUrl string
var integrationName string
var jsonFilePath string
var commitName string
var exclusions = file.Exclusions()
var inclusions = file.Exclusions()
var verbose bool
var regenerate int
var versionHint bool
var noResolve bool
var integrationName string
var jsonFilePath string
var minFingerprintContentLength int
var noFingerprint bool
var passOnDowntime bool
var callgraph bool
var noResolve bool
var npmPreferred bool
var callgraphUploadTimeout int
var callgraphGenerateTimeout int
var minFingerprintContentLength int
var passOnDowntime bool
var regenerate int
var repositoryName string
var repositoryUrl string
var verbose bool
var versionHint bool

const (
RepositoryFlag = "repository"
CommitFlag = "commit"
BranchFlag = "branch"
CallGraphFlag = "callgraph"
CallGraphGenerateTimeoutFlag = "callgraph-generate-timeout"
CallGraphUploadTimeoutFlag = "callgraph-upload-timeout"
CommitFlag = "commit"
CommitAuthorFlag = "author"
RepositoryUrlFlag = "repository-url"
IntegrationFlag = "integration"
ExclusionFlag = "exclusion"
IntegrationFlag = "integration"
InclusionFlag = "inclusion"
VerboseFlag = "verbose"
VersionHintFlag = "version-hint"
RegenerateFlag = "regenerate"
JsonFilePathFlag = "json-path"
MinFingerprintContentLengthFlag = "min-fingerprint-content-length"
NoResolveFlag = "no-resolve"
NoFingerprintFlag = "no-fingerprint"
PassOnTimeOut = "pass-on-timeout"
CallGraphFlag = "callgraph"
CallGraphUploadTimeoutFlag = "callgraph-upload-timeout"
CallGraphGenerateTimeoutFlag = "callgraph-generate-timeout"
NpmPreferredFlag = "prefer-npm"
JsonFilePathFlag = "json-path"
MinFingerprintContentLengthFlag = "min-fingerprint-content-length"
PassOnTimeOut = "pass-on-timeout"
RegenerateFlag = "regenerate"
RepositoryFlag = "repository"
RepositoryUrlFlag = "repository-url"
VerboseFlag = "verbose"
VersionHintFlag = "version-hint"
)

var scanCmdError error
Expand All @@ -69,9 +69,11 @@ If the given path contains a git repository all flags but "integration" will be
_ = viper.BindPFlags(cmd.Flags())
},
RunE: func(cmd *cobra.Command, args []string) error {
if strings.HasPrefix(strings.ToLower(viper.GetString(RepositoryFlag)), "c") && !cmd.Flags().Changed(NoFingerprintFlag) {
viper.Set(NoFingerprintFlag, false)
} // Temporary addition for rolling release of fingerprinting enabled by default
if len(viper.GetString(RepositoryFlag)) > 0 {
if strings.ToLower(viper.GetString(RepositoryFlag))[0] < 'd' && !cmd.Flags().Changed(NoFingerprintFlag) {
viper.Set(NoFingerprintFlag, false)
} // Temporary addition for rolling release of fingerprinting enabled by default
}

return RunE(&scanner)(cmd, args)
},
Expand Down

0 comments on commit bf1f53a

Please sign in to comment.