Skip to content
This repository has been archived by the owner on Apr 1, 2022. It is now read-only.

Commit

Permalink
Removes v1 compatibility mode (#383)
Browse files Browse the repository at this point in the history
  • Loading branch information
meghfossa authored Nov 1, 2021
1 parent bf661e7 commit 386430a
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 112 deletions.
6 changes: 6 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Spectrometer Changelog

## v2.19.3

- Removes `fossa compatibility` command. ([#383](https://github.com/fossas/spectrometer/pull/383))

Use [`fossa-deps.{yml,json}`](docs/features/vendored-dependencies.md) file to facilitate archive uploading capability, previously provided by `fossa compatibility` command.

## v2.19.2

- Adds `--config` flag, which can set custom path for configuration file. If `--config` flag is not used, base directory will scanned for `.fossa.yml` file. ([#415](https://github.com/fossas/spectrometer/pull/415))
Expand Down
1 change: 0 additions & 1 deletion spectrometer.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ library
App.Fossa.ArchiveUploader
App.Fossa.BinaryDeps
App.Fossa.BinaryDeps.Jar
App.Fossa.Compatibility
App.Fossa.Configuration
App.Fossa.Container
App.Fossa.Container.Analyze
Expand Down
47 changes: 0 additions & 47 deletions src/App/Fossa/Compatibility.hs

This file was deleted.

15 changes: 0 additions & 15 deletions src/App/Fossa/EmbeddedBinary.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module App.Fossa.EmbeddedBinary (
BinaryPaths,
withWigginsBinary,
withSyftBinary,
withCLIv1Binary,
allBins,
PackagedBinary (..),
) where
Expand All @@ -27,7 +26,6 @@ import Prelude hiding (writeFile)
data PackagedBinary
= Syft
| Wiggins
| CLIv1
deriving (Show, Eq, Enum, Bounded)

allBins :: [PackagedBinary]
Expand Down Expand Up @@ -57,14 +55,6 @@ withWigginsBinary ::
m c
withWigginsBinary = withEmbeddedBinary Wiggins

withCLIv1Binary ::
( Has (Lift IO) sig m
, MonadIO m
) =>
(BinaryPaths -> m c) ->
m c
withCLIv1Binary = withEmbeddedBinary CLIv1

withEmbeddedBinary ::
( Has (Lift IO) sig m
, MonadIO m
Expand Down Expand Up @@ -96,7 +86,6 @@ writeBinary :: (Has (Lift IO) sig m) => Path Abs File -> PackagedBinary -> m ()
writeBinary dest bin = sendIO . writeExecutable dest $ case bin of
Syft -> embeddedBinarySyft
Wiggins -> embeddedBinaryWiggins
CLIv1 -> embeddedBinaryCLIv1

writeExecutable :: Path Abs File -> ByteString -> IO ()
writeExecutable path content = do
Expand All @@ -107,7 +96,6 @@ writeExecutable path content = do
extractedPath :: PackagedBinary -> Path Rel File
extractedPath bin = case bin of
Syft -> $(mkRelFile "syft")
CLIv1 -> $(mkRelFile "cliv1")
-- Rename wiggins upon local extraction so that we can provide a better status line to users during the VSI strategy.
-- Users don't know what "wiggins" is, but they explicitly enable the VSI plugin, so this is more intuitive.
Wiggins -> $(mkRelFile "vsi-plugin")
Expand All @@ -131,6 +119,3 @@ embeddedBinaryWiggins = $(embedFileIfExists "vendor-bins/wiggins")

embeddedBinarySyft :: ByteString
embeddedBinarySyft = $(embedFileIfExists "vendor-bins/syft")

embeddedBinaryCLIv1 :: ByteString
embeddedBinaryCLIv1 = $(embedFileIfExists "vendor-bins/cliv1")
15 changes: 0 additions & 15 deletions src/App/Fossa/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import App.Fossa.Analyze (
VSIAnalysisMode (..),
analyzeMain,
)
import App.Fossa.Compatibility (Argument, argumentParser, compatibilityMain)
import App.Fossa.Configuration (
ConfigFile (
configApiKey,
Expand Down Expand Up @@ -300,9 +299,6 @@ appMain = do
let apiOpts = ApiOpts optBaseUrl apikey
assertUserDefinedBinariesMain logSeverity baseDir apiOpts assertionMeta
--
CompatibilityCommand args -> do
compatibilityMain args
--
DumpBinsCommand dir -> do
basedir <- validateDir dir
for_ Embed.allBins $ Embed.dumpEmbeddedBinary $ unBaseDir basedir
Expand Down Expand Up @@ -412,12 +408,6 @@ hiddenCommands =
(DumpBinsCommand <$> baseDirArg)
(progDesc "Output all embedded binaries to specified path")
)
<> command
"compatibility"
( info
(CompatibilityCommand <$> compatibilityOpts)
(progDesc "Run fossa cli v1 analyze. Supply arguments as \"fossa compatibility -- --project test\"")
)
<> command
"experimental-link-user-defined-dependency-binary"
( info
Expand Down Expand Up @@ -654,10 +644,6 @@ containerDumpScanOptions =
<$> optional (strOption (short 'o' <> long "output-file" <> help "File to write the scan data (omit for stdout)"))
<*> imageTextArg

compatibilityOpts :: Parser [Argument]
compatibilityOpts =
many argumentParser

assertUserDefinedBinariesOpts :: Parser AssertUserDefinedBinariesOptions
assertUserDefinedBinariesOpts =
AssertUserDefinedBinariesOptions
Expand Down Expand Up @@ -692,7 +678,6 @@ data Command
| VPSCommand VPSOptions
| ContainerCommand ContainerOptions
| AssertUserDefinedBinariesCommand AssertUserDefinedBinariesOptions
| CompatibilityCommand [Argument]
| ListTargetsCommand FilePath
| InitCommand
| DumpBinsCommand FilePath
Expand Down
34 changes: 0 additions & 34 deletions vendor_download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,40 +101,6 @@ else
echo "Forked Syft download successful"
fi

if $OS_WINDOWS; then
echo "Skipping cliv1 for Windows builds"
touch vendor-bins/cliv1
else
echo ""
echo "Downloading cliv1 binary"
CLIV1_RELEASE_JSON=vendor-bins/cliv1-release.json
curl -sSL \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3.raw" \
api.github.com/repos/fossas/fossa-cli/releases/latest > $CLIV1_RELEASE_JSON

# Remove leading 'v' from version tag
# 'v123' -> '123'
CLIV1_TAG=$(jq -cr '.name' $CLIV1_RELEASE_JSON | sed 's/^v//')
echo "Using fossas/fossa-cli release: $CLIV1_TAG"
FILTER=".name == \"fossa-cli_${CLIV1_TAG}_${ASSET_POSTFIX}_amd64.tar.gz\""
jq -c ".assets | map({url: .url, name: .name}) | map(select($FILTER)) | .[]" $CLIV1_RELEASE_JSON | while read ASSET; do
URL="$(echo $ASSET | jq -c -r '.url')"
NAME="$(echo $ASSET | jq -c -r '.name')"
OUTPUT=vendor-bins/${NAME%"-$ASSET_POSTFIX"}

echo "Downloading '$NAME' to '$OUTPUT'"
curl -sL -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/octet-stream" -s $URL > $OUTPUT
echo "Extracting cliv1 binary from tarball"
tar xzf $OUTPUT fossa
mv fossa vendor-bins/cliv1
rm $OUTPUT

done
rm $CLIV1_RELEASE_JSON
echo "CLI v1 download successful"
fi

echo "Marking binaries executable"
chmod +x vendor-bins/*

Expand Down

0 comments on commit 386430a

Please sign in to comment.