Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
FuryLion Fastlane plugin
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vadim Vlasov
FuryLion Fastlane plugin
Commits
62976b9a
Commit
62976b9a
authored
Aug 30, 2024
by
Vadim Vlasov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added restore_cache and try_update_cache
parent
790f13ad
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
131 additions
and
1 deletion
+131
-1
lib/fastlane/plugin/furylion/actions/restore_cache.rb
lib/fastlane/plugin/furylion/actions/restore_cache.rb
+60
-0
lib/fastlane/plugin/furylion/actions/try_update_cache.rb
lib/fastlane/plugin/furylion/actions/try_update_cache.rb
+70
-0
lib/fastlane/plugin/furylion/version.rb
lib/fastlane/plugin/furylion/version.rb
+1
-1
No files found.
lib/fastlane/plugin/furylion/actions/restore_cache.rb
0 → 100644
View file @
62976b9a
module
Fastlane
module
Actions
class
RestoreCacheAction
<
Action
def
self
.
run
(
params
)
if
params
[
:ignore_cache
]
UI
.
message
(
"Skipping cache restoration."
)
return
end
directory
=
params
[
:directory
]
cache_storage_path
=
params
[
:cache_storage_path
]
if
Dir
.
exist?
(
cache_storage_path
)
UI
.
message
(
"Restoring cache..."
)
output
=
`rsync -a --delete
#{
cache_storage_path
}
/
#{
directory
}
/`
puts
output
unless
output
.
strip
.
empty?
UI
.
message
(
"Cache restored from
#{
cache_storage_path
}
"
)
else
UI
.
message
(
"Cache directory not found. Skipping cache restoration."
)
end
end
def
self
.
description
"Restores the cache from a specified storage path to a local directory"
end
def
self
.
authors
[
"Vadim Vlasov"
]
end
def
self
.
available_options
[
FastlaneCore
::
ConfigItem
.
new
(
key: :directory
,
description:
"Local directory where the cache will be restored"
,
optional:
true
,
default_value:
"Library"
,
type:
String
),
FastlaneCore
::
ConfigItem
.
new
(
key: :cache_storage_path
,
optional:
true
,
default_value:
"
#{
Dir
.
home
}
/Data/Cache/
#{
ENV
[
'CI_PROJECT_PATH_SLUG'
]
}
/Library"
,
env_name:
"CACHE_STORAGE_PATH"
,
description:
"Storage path from where the cache will be restored"
,
type:
String
),
FastlaneCore
::
ConfigItem
.
new
(
key: :ignore_cache
,
env_name:
"IGNORE_CACHE"
,
description:
"If set, cache restoration will be skipped"
,
optional:
true
,
is_string:
false
,
default_value:
false
)
]
end
def
self
.
is_supported?
(
platform
)
true
end
end
end
end
\ No newline at end of file
lib/fastlane/plugin/furylion/actions/try_update_cache.rb
0 → 100644
View file @
62976b9a
module
Fastlane
module
Actions
class
TryUpdateCacheAction
<
Action
def
self
.
run
(
params
)
if
params
[
:ignore_cache
]
UI
.
message
(
"Skipping cache restoration."
)
return
end
branch
=
`git rev-parse --abbrev-ref HEAD`
.
strip
allowed_update_branches
=
params
[
:allowed_update_branches
]
directory
=
params
[
:directory
]
cache_storage_path
=
params
[
:cache_storage_path
]
if
allowed_update_branches
.
include?
(
branch
)
UI
.
message
(
"Updating cache..."
)
# Create cache storage directory if it doesn't exist
FileUtils
.
mkdir_p
(
cache_storage_path
)
unless
Dir
.
exist?
(
cache_storage_path
)
output
=
`rsync -a --delete
#{
directory
}
/
#{
cache_storage_path
}
/`
puts
output
unless
output
.
strip
.
empty?
UI
.
message
(
"Cache saved in
#{
cache_storage_path
}
"
)
else
UI
.
message
(
"Cache not updated as the branch is not in the allowed update list"
)
end
end
def
self
.
description
"Saves the cache from a local directory to a specified storage path if the current branch is allowed"
end
def
self
.
authors
[
"Vadim Vlasov"
]
end
def
self
.
available_options
[
FastlaneCore
::
ConfigItem
.
new
(
key: :allowed_update_branches
,
description:
"List of branches that are allowed to update the cache"
,
optional:
true
,
default_value:
[
"develop"
,
"feature/cicd-cache-library"
],
type:
Array
),
FastlaneCore
::
ConfigItem
.
new
(
key: :directory
,
description:
"Local directory from which the cache will be saved"
,
optional:
true
,
default_value:
"Library"
,
type:
String
),
FastlaneCore
::
ConfigItem
.
new
(
key: :cache_storage_path
,
description:
"Storage path where the cache will be saved"
,
optional:
true
,
default_value:
"
#{
Dir
.
home
}
/Data/Cache/
#{
ENV
[
'CI_PROJECT_PATH_SLUG'
]
}
/Library"
,
env_name:
"CACHE_STORAGE_PATH"
,
type:
String
),
FastlaneCore
::
ConfigItem
.
new
(
key: :ignore_cache
,
env_name:
"IGNORE_CACHE"
,
description:
"If set, cache restoration will be skipped"
,
optional:
true
,
is_string:
false
,
default_value:
false
)
]
end
def
self
.
is_supported?
(
platform
)
true
end
end
end
end
\ No newline at end of file
lib/fastlane/plugin/furylion/version.rb
View file @
62976b9a
module
Fastlane
module
Furylion
VERSION
=
"1.1.
3
"
VERSION
=
"1.1.
4
"
end
end
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