1
0
mirror of https://github.com/jerikan-network/cmdb.git synced 2024-05-06 04:54:50 +00:00

Merge pull request #3 from ClashTheBunny/rename_master_to_main

Change references from master to main
This commit is contained in:
Vincent Bernat
2021-06-21 07:29:25 +02:00
committed by GitHub
5 changed files with 19 additions and 19 deletions

View File

@@ -2,4 +2,4 @@ output/
.venv/
.cache~/
.pytest_cache/
master.zip
main.zip

2
.gitignore vendored
View File

@@ -2,7 +2,7 @@
/.venv/
/.cache~/
/.pytest_cache/
/master.zip
/main.zip
*.pyc
.DS_Store

View File

@@ -11,7 +11,7 @@ build templates:
stage: build
tags: [network]
script:
# Retrieve master output if we are in a merge request
# Retrieve main output if we are in a merge request
- |
if test -n "$CI_MERGE_REQUEST_ID"; then
echo "Target branch is $CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
@@ -23,20 +23,20 @@ build templates:
echo "Common ancestor with $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME is $ref"
echo "Pulling docker image $image"
docker pull $image
echo "Extract to output-master"
echo "Extract to output-main"
docker container create --name tmp_$$ $image nothing
mkdir output-master
mkdir output-main
docker container export tmp_$$ \
| tar -C output-master -xf - --strip-components=1 --wildcards output/\*
| tar -C output-main -xf - --strip-components=1 --wildcards output/\*
docker container rm tmp_$$
fi
# Build templates
- docker-compose rm -s -f -v
- docker image rm --no-prune cmdb_jerikan-ci:latest || true
- docker-compose pull
- SERVICE=jerikan-ci ./run build $(test -n "$CI_MERGE_REQUEST_ID" && echo --diff=output-master)
- SERVICE=jerikan-ci ./run build $(test -n "$CI_MERGE_REQUEST_ID" && echo --diff=output-main)
rules:
- if: $CI_COMMIT_BRANCH == "master"
- if: $CI_COMMIT_BRANCH == "main"
- if: $CI_MERGE_REQUEST_ID
cache:
paths:
@@ -55,7 +55,7 @@ push artifacts to registry:
stage: report
tags: [network]
rules:
- if: $CI_COMMIT_BRANCH == "master"
- if: $CI_COMMIT_BRANCH == "main"
- if: $CI_MERGE_REQUEST_ID
dependencies:
- build templates
@@ -74,7 +74,7 @@ diff generated:
- docker-compose build diff2html
- (cat output/*/diff.txt; echo) | docker-compose run --rm diff2html > diff.html
artifacts:
expose_as: differences with master
expose_as: differences with main
expire_in: 1 month
paths:
- diff.html

View File

@@ -131,7 +131,7 @@ Host `none` also comes with additional tags to limit its scope. They
all start with `deploy:`.
`./run-ansible-gitlab` will run against the data generated by GitLab
CI for the current master. You need to login to GitLab registry to
CI for the current main. You need to login to GitLab registry to
make it work. If you prefer to generate the data locally with Jerikan,
use `./run-ansible` instead. From time to time, you can cleanup
fetched configurations:
@@ -201,15 +201,15 @@ $ ./run-ansible-gitlab playbooks/site.yaml --limit=none -t deploy:irr -v --check
$ ./run-ansible-gitlab playbooks/site.yaml --limit=none -t deploy:netbox -v --diff --check
```
### Use another base than master for ./run-ansible-gitlab
### Use another base than main for ./run-ansible-gitlab
By default, `./run-ansible-gitlab` will use the output compiled from
master by GitLab. If needed, this is possible use an older version of
master or the result of a merge request. For this, you need to
main by GitLab. If needed, this is possible use an older version of
main or the result of a merge request. For this, you need to
retrieve the SHA of the commit to use as a base.
For older versions of master, the [commit
history](https://gitlab.com/blade-group/infra/network/cmdb/-/commits/master)
For older versions of main, the [commit
history](https://github.com/jerikan-network/cmdb/commits)
as the information. Use the clipboard icon to retrieve the full SHA.
Only the commits with a green checkmark will work. For MR, you can get
the same information from the "Commits" tab. Only the top-most commit

6
run
View File

@@ -26,10 +26,10 @@ case $SERVICE in
mkdir -p .cache~ output
;;
ansible-gitlab)
# Grab `output` from Gitlab. By default, latest master is
# Grab `output` from Gitlab. By default, latest main is
# used. Beware that local ansible/ content is still used.
remote=$(git for-each-ref --format='%(upstream:remotename)' refs/heads/master)
export SHA=${SHA:-$(git fetch -q ${remote} && git show-ref -s remotes/${remote}/master)}
remote=$(git for-each-ref --format='%(upstream:remotename)' refs/heads/main)
export SHA=${SHA:-$(git fetch -q ${remote} && git show-ref -s remotes/${remote}/main)}
docker-compose build ansible-gitlab
;;
esac