Skip to content

Instantly share code, notes, and snippets.

@dimMaryanto93
Last active June 18, 2023 05:47
Show Gist options
  • Save dimMaryanto93/fd40c02b1cc0d4eccb7c03103397591b to your computer and use it in GitHub Desktop.
Save dimMaryanto93/fd40c02b1cc0d4eccb7c03103397591b to your computer and use it in GitHub Desktop.
gitlab-ci cources
job1:
image: alpine:latest
script: "echo 'Hi my name is Dimas Maryanto'"
build-job:
stage: build
variables:
MY_NAME: "Dimas Maryanto"
script:
- echo "Hello, my name is $MY_NAME ! \n i'm trying to learn CI/CD feature with Gitlab CI"
## other jobs here
## other job here
test-job1:
stage: test
script:
- echo "This job tests something"
only:
- /-release/
test-job2:
stage: test
script:
- echo "This job tests something, but takes more time than test-job1."
- echo "After the echo commands complete, it runs the sleep command for 20 seconds"
- echo "which simulates a test that runs 20 seconds longer than test-job1"
- sleep 20
when: manual
deploy-prod:
stage: deploy
rules:
- if: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^hotfix/
when: manual
- if: $CI_COMMIT_REF_SLUG == $CI_DEFAULT_BRANCH
when: always
- when: never
script:
- echo "This job deploys something from the $CI_COMMIT_BRANCH branch."
environment: production
build-job:
stage: build
script:
- echo "Hello, $GITLAB_USER_LOGIN!"
test-job1:
stage: test
script:
- echo "This job tests something"
test-job2:
stage: test
script:
- echo "This job tests something, but takes more time than test-job1."
- echo "After the echo commands complete, it runs the sleep command for 20 seconds"
- echo "which simulates a test that runs 20 seconds longer than test-job1"
- sleep 20
deploy-prod:
stage: deploy
script:
- echo "This job deploys something from the $CI_COMMIT_BRANCH branch."
environment: production
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment