Community Announcements have moved! To stay up to date, please join the new Community Announcements group today. Learn more
×pipelines:
branches:
release/dev:
- step:
name: Detect Changed Modules & Build
caches:
- gradle
script:
- echo "Changed modules: $BITBUCKET_COMMIT_RANGE"
- CHANGED_MODULES=$(git diff --name-only $BITBUCKET_COMMIT_RANGE | cut -d/ -f1 | sort -u)
- echo "Detected modules: $CHANGED_MODULES"
- |
for module in $CHANGED_MODULES; do
if [ -f "$module/build.gradle" ]; then
echo "Building $module ..."
gradle :$module:clean :$module:build || exit 1
fi
done
artifacts:
- "*/build/libs/*.jar"
- step:
name: Deploy Changed Modules
deployment: release/dev
script:
- echo "Deploying to Windows Server ..."
- CHANGED_MODULES=$(git diff --name-only $BITBUCKET_COMMIT_RANGE | cut -d/ -f1 | sort -u)
- echo "Detected modules: $CHANGED_MODULES"
- |
for module in $CHANGED_MODULES; do
if [ -d "$module/build/libs" ]; then
echo "Deploying $module ..."
scp -P 2222 -o StrictHostKeyChecking=no \
$module/build/libs/*.jar \
$WINDOWS_USER@$WINDOWS_HOST:"/C/Users/$WINDOWS_USER/deploy/brycenBackEnd/$module/"
fi
done
bitbucket-pipeline.yml setting
pipelie executing -->
There is an error in your bitbucket-pipelines.yml at [pipelines > branches > release/dev > 0 > step > script > 0]. Missing or empty command string. Each item in this list should either be a single command string or a map defining a pipe invocation.
help me
Hi @정형진
Welcome to the community.
Please find the following example
image: openjdk:11 pipelines: branches: release/dev: - step: name: Detect Changed Modules & Build caches: - gradle script: - | echo "Changed modules: $BITBUCKET_COMMIT_RANGE" CHANGED_MODULES=$(git diff --name-only $BITBUCKET_COMMIT_RANGE | cut -d/ -f1 | sort -u) echo "Detected modules: $CHANGED_MODULES" for module in $CHANGED_MODULES; do if [ -f "$module/build.gradle" ]; then echo "Building $module ..." ./gradlew :$module:clean :$module:build || exit 1 fi done artifacts: - "*/build/libs/*.jar" - step: name: Deploy Changed Modules deployment: dev script: - | echo "Deploying to Windows Server ..." CHANGED_MODULES=$(git diff --name-only $BITBUCKET_COMMIT_RANGE | cut -d/ -f1 | sort -u) echo "Detected modules: $CHANGED_MODULES" for module in $CHANGED_MODULES; do if [ -d "$module/build/libs" ]; then echo "Deploying $module ..." scp -P 2222 -o StrictHostKeyChecking=no \ $module/build/libs/*.jar \ $WINDOWS_USER@$WINDOWS_HOST:"/C/Users/$WINDOWS_USER/deploy/brycenBackEnd/$module/" fi done
Each script
section uses a single pipe block (- |
) so that variable assignments and loops work as expected.
No mixing of single command strings and pipe blocks in the same step.
Indentation uses spaces only.
That said I suggest use ./gradlew
for Gradle builds instead of script. I hope this helps
Regards,
Syahrul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.