2022-09-03

gitlab

Nana: https://www.youtube.com/watch?v=qP8kir2GUgo

https://www.youtube.com/watch?v=PGyhBwLyK2U 

(https://www.youtube.com/watch?v=8aV5AxJrHDg&list=PLZMWkkQEwOPmGolqJPsAm_4fcBDDc2to_)

image: amazoncorretto:11-alpine-jdk

variables:
UNAME: ${UNAME}
PASSWD: ${PASSWD}
stages: # List of stages for jobs, and their order of execution
- build
- test
- deploy

build-job: # This job runs in the build stage, which runs first.
stage: build
script:
- echo "Compiling the code..."
- java -version
- ./gradlew clean build
- echo $UNAME
- echo ${UNAME}
- echo "Compile complete."
artifacts:
untracked: false
expire_in: 1 days
paths:
# - build
- "build/libs/demo-0.0.1.jar"

unit-test-job: # This job runs in the test stage.
stage: test # It only starts when the job in the build stage completes successfully.
script:
- echo "Running unit tests... This will take about 6 seconds."
- sleep 0
- echo "Code coverage is 90%"
- ls build/libs/demo-0.0.1.jar
- ./gradlew test
- echo $PASSWD

.lint-test-job: # This job also runs in the test stage.
stage: test # It can run at the same time as unit-test-job (in parallel).
script:
- echo "Linting code... This will take about 1 seconds."
- sleep 0
- echo "No lint issues found."

deploy-job: # This job runs in the deploy stage.
when: manual
# rules:
# - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
stage: deploy # It only runs when *both* jobs in the test stage complete successfully.
image:
name: amazon/aws-cli
entrypoint: [""]
environment: production
script:
- echo "Deploying application..."
- echo $CI_COMMIT_MESSAGE > /tmp/CI_COMMIT_MESSAGE
- ls build/libs/demo-0.0.1.jar
- aws --version
- aws s3 cp /tmp/CI_COMMIT_MESSAGE s3://demobucketencaps/CI_COMMIT_MESSAGE
- aws s3 cp build/libs/demo-0.0.1.jar s3://demobucketencaps/demo-0.0.1.jar
- echo "Application successfully deployed."
git reset filename.txt 
git rm --cached filename.txt git delete

git config --global credential.helper 'cache --timeout=604800'

No comments: