Skip to content

Commit

Permalink
t1
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk committed Feb 27, 2024
1 parent 22b37c8 commit 48744ad
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ jobs:
export TEST_FILE="test-file--force-push--circleci--${CIRCLE_BRANCH//\//-}.txt"
echo "Deployment 1 for branch $CIRCLE_BRANCH" >> $TEST_FILE
date "+%Y%m%d-%H%M%S" >> $TEST_FILE
echo $TEST_FILE > $HOME/test-file.txt
- run:
name: Deployment 1
Expand All @@ -101,7 +102,7 @@ jobs:
DEPLOYED_BRANCH=$(sed -n 's/Remote branch://p' $HOME/report--mode--force-push.txt | sed 's/ //g')
echo "Deployed to $DEPLOYED_BRANCH"
echo
echo "See https://github.com/drevops/git-artifact-destination/blob/$DEPLOYED_BRANCH/$TEST_FILE"
echo "See https://github.com/drevops/git-artifact-destination/blob/$DEPLOYED_BRANCH/$(cat $HOME/test-file.txt)"
rm $HOME/report--mode--force-push.txt
- run:
Expand All @@ -125,7 +126,7 @@ jobs:
DEPLOYED_BRANCH=$(sed -n 's/Remote branch://p' $HOME/report--mode--force-push.txt | sed 's/ //g')
echo "Deployed to $DEPLOYED_BRANCH"
echo
echo "See https://github.com/drevops/git-artifact-destination/blob/$DEPLOYED_BRANCH/$TEST_FILE"
echo "See https://github.com/drevops/git-artifact-destination/blob/$DEPLOYED_BRANCH/$(cat $HOME/test-file.txt)"
# Demonstration of deployment in 'branch' mode.
# Note that by design, pushing into the same branch will result in the failure
Expand Down Expand Up @@ -157,6 +158,7 @@ jobs:
export TEST_FILE="test-file--branch--circleci--${CIRCLE_BRANCH//\//-}.txt"
echo "Deployment 1 for branch $CIRCLE_BRANCH" >> $TEST_FILE
date "+%Y%m%d-%H%M%S" >> $TEST_FILE
echo $TEST_FILE > $HOME/test-file.txt
- run:
name: Deployment 1
Expand All @@ -172,16 +174,9 @@ jobs:
DEPLOYED_BRANCH=$(sed -n 's/Remote branch://p' $HOME/report--mode--branch.txt | sed 's/ //g')
echo "Deployed to $DEPLOYED_BRANCH"
echo
echo "See https://github.com/drevops/git-artifact-destination/blob/$DEPLOYED_BRANCH/$TEST_FILE"
echo "See https://github.com/drevops/git-artifact-destination/blob/$DEPLOYED_BRANCH/$(cat $HOME/test-file.txt)"
rm $HOME/report--mode--branch.txt
- run:
name: Update the test file to simulate changes in the source repository.
command: |
export TEST_FILE="test-file--branch--circleci--${CIRCLE_BRANCH//\//-}.txt"
echo "Deployment 2 for branch $CIRCLE_BRANCH" >> $TEST_FILE
date "+%Y%m%d-%H%M%S" >> $TEST_FILE
- run:
name: Deployment 2 - same branch
command: |
Expand All @@ -194,6 +189,13 @@ jobs:
--debug \
&& { echo "Expected to fail as repeated pushes to the same branch are not allowed, but succeeded" >&2; exit 1; } || echo "Failed as expected"
- run:
name: Update the test file to simulate changes in the source repository.
command: |
export TEST_FILE="test-file--branch--circleci--${CIRCLE_BRANCH//\//-}.txt"
echo "Deployment 2 for branch $CIRCLE_BRANCH" >> $TEST_FILE
date "+%Y%m%d-%H%M%S" >> $TEST_FILE
- run:
name: Deployment 2 - new branch
command: |
Expand All @@ -208,7 +210,7 @@ jobs:
DEPLOYED_BRANCH=$(sed -n 's/Remote branch://p' $HOME/report--mode--branch.txt | sed 's/ //g')
echo "Deployed to $DEPLOYED_BRANCH"
echo
echo "See https://github.com/drevops/git-artifact-destination/blob/$DEPLOYED_BRANCH/$TEST_FILE"
echo "See https://github.com/drevops/git-artifact-destination/blob/$DEPLOYED_BRANCH/$(cat $HOME/test-file.txt)"
workflows:
version: 2
Expand Down

0 comments on commit 48744ad

Please sign in to comment.