From a6911d27da8031df5bc1b012971d0c57cbf4ce56 Mon Sep 17 00:00:00 2001 From: Randall Mason Date: Sun, 20 Jun 2021 16:09:13 -0500 Subject: [PATCH 1/2] Change references from master to main --- .dockerignore | 2 +- .gitignore | 2 +- .gitlab-ci.yml | 16 ++++++++-------- README.md | 8 ++++---- run | 6 +++--- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.dockerignore b/.dockerignore index ed7e555..f442405 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,4 +2,4 @@ output/ .venv/ .cache~/ .pytest_cache/ -master.zip +main.zip diff --git a/.gitignore b/.gitignore index 4ee9b66..dd250e4 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ /.venv/ /.cache~/ /.pytest_cache/ -/master.zip +/main.zip *.pyc .DS_Store diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index aeb24b3..fdd62d9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/README.md b/README.md index 9dfbfb4..cf8bbc1 100644 --- a/README.md +++ b/README.md @@ -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,11 +201,11 @@ $ ./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 diff --git a/run b/run index 6003845..3458fee 100755 --- a/run +++ b/run @@ -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 From 210be78b350393ca28f2099b041036864c380271 Mon Sep 17 00:00:00 2001 From: Randall Mason Date: Sun, 20 Jun 2021 18:30:53 -0500 Subject: [PATCH 2/2] Update to Github commit history --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cf8bbc1..f874369 100644 --- a/README.md +++ b/README.md @@ -208,8 +208,8 @@ 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