Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bobgo-magento-extension
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bob Public Utils
bobgo-magento-extension
Merge requests
!24
Dev -> Prod
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
Dev -> Prod
dev
into
prod
Overview
0
Commits
10
Pipelines
15
Changes
32
Merged
Dev -> Prod
Francé Wilke
requested to merge
dev
into
prod
6 months ago
Overview
0
Commits
10
Pipelines
15
Changes
1
0
0
Merge request reports
Compare
version 4
version 8
33610036
6 months ago
version 7
067a38d6
6 months ago
version 6
38195f10
6 months ago
version 5
d970e84b
6 months ago
version 4
163f9b52
6 months ago
version 3
857582b0
6 months ago
version 2
8ee31863
6 months ago
version 1
32a35787
6 months ago
prod (base)
and
version 8
latest version
32ac7698
10 commits,
6 months ago
version 8
33610036
9 commits,
6 months ago
version 7
067a38d6
8 commits,
6 months ago
version 6
38195f10
7 commits,
6 months ago
version 5
d970e84b
6 commits,
6 months ago
version 4
163f9b52
5 commits,
6 months ago
version 3
857582b0
4 commits,
6 months ago
version 2
8ee31863
3 commits,
6 months ago
version 1
32a35787
2 commits,
6 months ago
Show latest version
1 file
+
8
−
36
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
.gitlab-ci.yml
+
8
−
36
View file @ 33610036
Edit in single-file editor
Open in Web IDE
Show full file
@@ -2,7 +2,7 @@ image: shiplogic/ci-wp-plugin:node18
variables
:
GIT_SUBMODULE_STRATEGY
:
recursive
MAX_TAGS_TO_KEEP
:
5
# Number of most recent tag versions to keep
MAX_TAGS_TO_KEEP
:
5
stages
:
-
deploy
@@ -21,55 +21,27 @@ deploy:
-
./make-zip.sh
-
aws s3 cp bobgo-magento-plugin.zip s3://bobgo-s3-magento-plugin-dev/ --region=af-south-1
rules
:
-
if
:
'
$CI_COMMIT_BRANCH
==
"dev"
&&
$CI_
COMMIT_TAG
==
null'
-
if
:
$CI_COMMIT_BRANCH == "dev" && $CI_
PIPELINE_SOURCE == "push"
when
:
always
tag_deploy
:
stage
:
tag_deploy
image
:
shiplogic/ci-wp-plugin:node18
before_script
:
# Export AWS credentials for prod branch (since tags are created from prod)
-
AWS_ACCESS_KEY_ID_KEY="prod_AWS_ACCESS_KEY_ID"
-
AWS_SECRET_ACCESS_KEY_KEY="prod_AWS_SECRET_ACCESS_KEY"
-
AWS_ACCESS_KEY_ID=$(eval echo -e "\$$AWS_ACCESS_KEY_ID_KEY")
-
AWS_SECRET_ACCESS_KEY=$(eval echo -e "\$$AWS_SECRET_ACCESS_KEY_KEY")
-
export AWS_ACCESS_KEY_ID
-
export AWS_SECRET_ACCESS_KEY
# Check if variables are set (without exposing values)
-
if [ -z "$AWS_ACCESS_KEY_ID" ]; then echo "AWS_ACCESS_KEY_ID is empty"; else echo "AWS_ACCESS_KEY_ID is set"; fi
-
if [ -z "$AWS_SECRET_ACCESS_KEY" ]; then echo "AWS_SECRET_ACCESS_KEY is empty"; else echo "AWS_SECRET_ACCESS_KEY is set"; fi
# Verify tag was created from prod branch
-
git fetch origin prod
-
COMMIT_BRANCH=$(git branch -r --contains $CI_COMMIT_SHA | grep "origin/prod" || echo "")
-
if [ -z "$COMMIT_BRANCH" ]; then echo "Tag was not created from prod branch. Skipping deployment."; exit 1; fi
script
:
# Download the tagged version archive
-
TAG_ARCHIVE_URL="https://gitlab.bob.co.za/bob-public-utils/bobgo-magento-extension/-/archive/${CI_COMMIT_TAG}/bobgo-magento-extension-${CI_COMMIT_TAG}.zip"
-
curl -o "bobgo-magento-extension-${CI_COMMIT_TAG}.zip" "$TAG_ARCHIVE_URL"
# Upload to S3 bucket both as versioned and as "latest"
-
aws s3 cp "bobgo-magento-extension-${CI_COMMIT_TAG}.zip" "s3://bobgo-s3-magento-plugin-prod/tags/bobgo-magento-extension-${CI_COMMIT_TAG}.zip" --region=af-south-1 --acl public-read
-
aws s3 cp "bobgo-magento-extension-${CI_COMMIT_TAG}.zip" "s3://bobgo-s3-magento-plugin-prod/latest/latest.zip" --region=af-south-1 --acl public-read
# Cleanup old tag versions - keep only the most recent MAX_TAGS_TO_KEEP
-
echo "Cleaning up old tag versions, keeping only the most recent $MAX_TAGS_TO_KEEP..."
-
aws s3 ls s3://bobgo-s3-magento-plugin-prod/tags/ --region=af-south-1 > tag_list.txt
-
grep "bobgo-magento-extension-" tag_list.txt > filtered_tags.txt
-
sort -r filtered_tags.txt > sorted_tags.txt
-
tail -n +$((MAX_TAGS_TO_KEEP + 1)) sorted_tags.txt > tags_to_delete.txt
-
cat tags_to_delete.txt | awk '{print $4}' > keys_to_delete.txt
-
|
while read KEY; do
echo "Deleting old tag version: $KEY"
aws s3 rm "s3://bobgo-s3-magento-plugin-prod/tags/$KEY" --region=af-south-1
done < keys_to_delete.txt
# Output the URLs
-
echo "Tagged version URL
:
https://bobgo-s3-magento-plugin-prod.s3.af-south-1.amazonaws.com/tags/bobgo-magento-extension-${CI_COMMIT_TAG}.zip"
-
echo "Latest version URL
:
https://bobgo-s3-magento-plugin-prod.s3.af-south-1.amazonaws.com/latest/latest.zip"
-
echo "Retained the latest $MAX_TAGS_TO_KEEP tag versions in S3 bucket."
-
"
TAG_ARCHIVE_URL=https://gitlab.bob.co.za/bob-public-utils/bobgo-magento-extension/-/archive/${CI_COMMIT_TAG}/bobgo-magento-extension-${CI_COMMIT_TAG}.zip"
-
curl -o bobgo-magento-extension-${CI_COMMIT_TAG}.zip "$TAG_ARCHIVE_URL"
-
aws s3 cp bobgo-magento-extension-${CI_COMMIT_TAG}.zip s3://bobgo-s3-magento-plugin-prod/tags/bobgo-magento-extension-${CI_COMMIT_TAG}.zip --region=af-south-1 --acl public-read
-
aws s3 cp bobgo-magento-extension-${CI_COMMIT_TAG}.zip s3://bobgo-s3-magento-plugin-prod/latest/bobgo-magento-extension-latest.zip --region=af-south-1 --acl public-read
-
echo "Tagged version URL in S3 bucket ready for download"
rules
:
-
if
:
'
$CI_COMMIT_TAG
'
-
if
:
$CI_COMMIT_TAG
when
:
always
\ No newline at end of file
Loading